Use long flags when scripting
thechangelog.com
Use long flags when scripting
1–10 of 133 posts
Re: Use long flags when scripting
#2This is a practice I use; in my opinion it is akin to descriptive variable names.
Re: Use long flags when scripting
#3Ironically, tab-completion works on the command-line for long options, but not in a script (I'm sure vim can do it though).
Re: Use long flags when scripting
#4Amen!
Re: Use long flags when scripting
#5Agreed! It saves a trip to the man page.
Something else I figured out recently is that if you put the pipe at the end of a line, you don't need a backslash:
echo thing |
grep thingRe: Use long flags when scripting
#6Time to update some of my scripts.
Re: Use long flags when scripting
#7I too have been using this practice for years now, unfortunately most coworkers don't seem to appreciate the genius of it.
Re: Use long flags when scripting
#8Agreed! It saves a trip to the man page. Something else I figured out recently is that if you put the pipe at the end of a line, you don't need a backslash: echo thing | grep thing
I have seen this working, but didn't understand why... thanks!
Re: Use long flags when scripting
#9No. Use standard POSIX flags to invoke standard POSIX functionality, so your scripts don't break when run on a different system.
Re: Use long flags when scripting
#10heh.. I have never thought of that. I basically script exactly how I construct commands in the cmd line, but the author is correct looking at my past bash scripts it would be better to use long options, good stuff.