Instead of writing tons and tons of small scripts < 10 lines that all depend on each other I have the habbit of writing them as functions and throwing them into one file (easier to edit, less worries about them depending on each other). To be able to use the functions from the bash shell, just add $(basename $0) “$@” to the END of the file, and add symlinks function_name -> file.
Example:
$ ln -s foo.sh foobar
$ cat foo.sh
Select All Code:
1 2 3 4 5 6 7 | #!/bin/bash foobar() { echo "world domination" return } $(basename $0) "$@" |
More From dopefish
dopefish Recommends
- Free web filter, firewall and vpn server (Sysadmin Ramblings)
- NumpadKey, an Android multitap keyboard (Sysadmin Ramblings)



No Comments on "bash foo"