Renaming Files With Underscores
Through the past 20 years I have written hundreds of shell scripts that are stored in my
/usr/local[s]bin directories. In the file names some scripts contained underscores and some dashes. Dashes are easier to type by avoiding the
I wanted to rename most of the scripts using underscores to names using dashes.
That sounded easy until realizing that scripts are used and sourced in other scripts and files. Thus began the hunt for all such locations.
I wrote yet another shell script to search and replace references of the old file name to the new file name. The exercise revealed that sometimes what seems to be an easy task is actually complicated. There were many places where a script could be used or referenced.
- /etc/functions-* (common functions sourced in scripts)
- sym links
The new script worked well. Through the next several days nothing broke on the system.