I wonder a bit, that those POSIX comments are so far in the bottom of this discussion. I mean, you are loosing portability by using long flags (because it is not standard compliant) and yet it seems to be just a footnote in this discussion...
Use long flags when scripting (2013)
161–170 of 197 posts
Re: Use long flags when scripting (2013)
#162Great suggestion, but I'd go for a middle ground: use long flags for the long tail, but short flags are fine for stuff that's very commonly used. I think I'll continue to write these: grep -i rm -rf ln -s gzip -v sed -e instead of: grep --ignore-case rm --recursive --force ln --symbolic gzip --verbose sed --expression If you're working on shell scripts, you probably know certain short flags well enough that long flag…
> If you're working on shell scripts, you probably know certain short flags well enough that long flags just add clutter and don't improve readability. What about other people who might read the script?
Re: Use long flags when scripting (2013)
#163Re: Use long flags when scripting (2013)
#164Earlier quoted context omitted.
I think you're assuming a level of Unix knowledge that less and less new people in the field are going to have.
Someone who's tasked with maintaining shell scripts better be familiar with the shell.
Kids today no longer know the shell. They think just writing some yaml files in ansible is sufficient. Giving them a shell script won't help at all.
Re: Use long flags when scripting (2013)
#165Earlier quoted context omitted.
Related to this, they're less likely to do something unexpected. Many programs use -v as a short flag for --version , but some (such as curl) use it as short for --verbose Probably something you'd catch pretty quickly, but still.
Wow, that's funny, I normally expect '-v' to be verbose, but maybe I just use a lot of `tar` and `curl`!
Re: Use long flags when scripting (2013)
#166Great suggestion, but I'd go for a middle ground: use long flags for the long tail, but short flags are fine for stuff that's very commonly used. I think I'll continue to write these: grep -i rm -rf ln -s gzip -v sed -e instead of: grep --ignore-case rm --recursive --force ln --symbolic gzip --verbose sed --expression If you're working on shell scripts, you probably know certain short flags well enough that long flag…
Re: Use long flags when scripting (2013)
#167Great suggestion, but I'd go for a middle ground: use long flags for the long tail, but short flags are fine for stuff that's very commonly used. I think I'll continue to write these: grep -i rm -rf ln -s gzip -v sed -e instead of: grep --ignore-case rm --recursive --force ln --symbolic gzip --verbose sed --expression If you're working on shell scripts, you probably know certain short flags well enough that long flag…
Re: Use long flags when scripting (2013)
#168Re: Use long flags when scripting (2013)
#169Earlier quoted context omitted.
Someone who's tasked with maintaining shell scripts better be familiar with the shell.
that's kinda his point. Kids today no longer know the shell. They think just writing some yaml files in ansible is sufficient. Giving them a shell script won't help at all.
Sounds like Kochan and Wood[0] need some love (and royalties).
Or is learning stuff deprecated these days?
[0] https://www.amazon.com/Unix-Shell-Programming-Stephen-Kochan...
Re: Use long flags when scripting (2013)
#170Enough idiotic Unix crypticism. Time to grow up and be responsible for making the code readable for the next unfortunate person having to mess with *sh scripts. No excuses, no shortcuts, no turning the time sunk learning random letter combinations into entry barriers for newcomers.