Ironically, tab-completion works on the command-line for long options, but not in a script (I'm sure vim can do it though).
Use long flags when scripting
11–20 of 133 posts
Re: Use long flags when scripting
#12Ironically, 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
#13Re: Use long flags when scripting
#14Re: Use long flags when scripting
#15Not everything has to be static text, one format does not fit all situations.
Re: Use long flags when scripting
#16No. Use standard POSIX flags to invoke standard POSIX functionality, so your scripts don't break when run on a different system.
For something you're planning to deploy to customers, it probably makes sense to play it pretty strict with POSIX.
Likewise, I usually script straight sh for portability if it's going to a customer unless there's a compelling reason to use bash. I'll mix in bash in stuff I write for myself where it makes my life simpler.
Re: Use long flags when scripting
#17This advice is good not only for others but setting a standard for yourself where you take a moment to learn what exactly is going on.
Re: Use long flags when scripting
#18Also, [0-9.] not [0-9\.]
Re: Use long flags when scripting
#19Disagree. There isn't and shouldn't be any hard fast rule for this. Same as most things in programming. Do what makes sense. Also, [0-9.] not [0-9\.]
Re: Use long flags when scripting
#20Disagree. There isn't and shouldn't be any hard fast rule for this. Same as most things in programming. Do what makes sense. Also, [0-9.] not [0-9\.]
--David S. Miller