News for hackers. Stuff that matters.
Re:Bash 5.0 released by ilikepi on Tuesday January 08, 2019 @08:11AM (#18855258)
Personally, I just don't bother trying to show the user their particular invocation:

    #!/bin/bash
    echo "Usage: $(basename $0) [OPTIONS]"
Re:Bash 5.0 released by Crestwave on Tuesday January 08, 2019 @08:44AM (#18855424)
Minor nitpick, but wouldn't ${0##*/} work as well?
Re:Bash 5.0 released by ilikepi on Tuesday January 08, 2019 @09:34AM (#18855712)
Yep! Not a nitpick at all. There's more than one way to do lots of things.

I prefer my version because it's easier for me to remember and read. I do use pattern substitution for other things, but I usually have to go to an interactive shell and create a test variable in order to remind myself whether I want # or %. I understand favoring built-in features over subshell calls for heavily used code, but I don't think this is especially critical for outputting usage info.

Re:Bash 5.0 released by LukeShu on Tuesday January 08, 2019 @10:54AM (#18856408)
Yes, that's what we've been stuck doing, because the full path included in $0 is useless if the program was run via $PATH.