44.22 Finding a Program Name; Multiple Program NamesA UNIX program should use its name as the first word in error messages it prints. That's important when the program is running in the background or as part of a pipeline - you need to know which program has the problem:
It's tempting to use just the program name in the echo commands: echo " but if you ever change the program name, it's easy to forget to fix the messages. A better way is to store the program name in a shell variable at the top of the script file, and then use the variable in all messages: myname=
Even better, use the For example, if myname="`basename $0`" would put sendit into the myname shell variable.
Just as you can make
links (18.3
)
to give UNIX files several names,
you can use links to
give your program several names (45.13
)
.
For instance, see the script named ll
, lf
, lg
(...and so on)
in article
16.7
.
Use - |
|