I want to pass a command line program by default when I run it.
myprog --foo=bar
The solution I could think of was to add a custom "myprog" wrapper to my "bin" folder
#! /bin/sh
/usr/bin/myprog --foo=bar $@
The good thing is that since I set up my system so the bin folder is in the PATH both for interactive shells and for GUI apps, calling myprog from anywhere will pass the --foo flag by default, including if I run myprog from the applications menu.
However, I didn't like that I had to use the absolute path to /usr/bin/myprog
in my wrapper script (if I don't it enters an infinite loop). Is there a better way to go at this?
"$@"
otherwise it really won't do what you think it does. QUOTE YOUR VARIABLES !!!!!!! – Chris Davies Apr 22 '15 at 16:26~/bin/myprog
should become separate arguments for/usr/bin/myprog
– hugomg Apr 22 '15 at 16:44$@
it's exactly the same as using$*
, which re-splits words by whitespace even if they were initially quoted to protect them. See this and this for further detail. – Chris Davies Apr 22 '15 at 18:41