I have the following code which should put programs startable in Bash.
if [ "`uname`" = "Darwin" ]; then
compctl -f -x 'p[2]' -s "`/bin/ls -d1 /Applications/*/*.app
/Application:/*.app | sed 's|^.*/\([^/]*\)\.app.*|\\1|;s/ /\\\\ /g'`"
-- open
alias run='open -a'
fi
However, it does not work in my Zsh at all. I can open no programs with it.
Another bug which it has is that it opens all programs.
I want have only programs startable which permissions is 700.
I know that you can search these programs rather well by
find -perm 700 -type f *.app
However, I could not get my find -command work exactly for each program file.
This suggests me that there may be a better way to make programs startable in terminal.
How can you make programs startable in Zsh in Mac/Ubuntu?
How do you feel about aliases instead of completion? The aliases still tab complete. Splitting across lines to make it easier to read…
The first prints each match on its own line, the second removes sub-packages of an app, and the last generates the alias command. Remove the backticks to see and confirm the commands that are generated.
[Edit:] This runs the executable directly – if you prefer to use the ‘open blah.app’ method, you could change the final portion of the sed command to: