Hacker News new | ask | show | jobs
by jolmg 2167 days ago
I think it'd be better without using basename, just $0. That way it matches the way it was called, which is how the user chose to access it for whatever reason. The bare filename might refer to a different command, even. Also, if you include examples in the help text, they'll also be able to copy and paste, instead of having to manually insert what basename stripped away.
1 comments

True enough - I find it depends a bit on the nature of the script - if it's something buried under misc/tools/extra/bin/util.sh - i tend to prefer brevity - especially in the first paragraph/usage section (util.sh <required param> [optional param]).

But for more concrete examples I'll often leave off the basename - for easier cut and paste.