-
-
Save crittelmeyer/0f12305252888ca87f2f to your computer and use it in GitHub Desktop.
A bash script to quickly create new bash scripts. It's scriptception.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
filename=$1 | |
script_root=/usr/bin | |
editor=vi | |
createScriptIfItDoesntExist() { | |
if [ ! -f $1 ]; then | |
touch $1 | |
chmod +x $1 | |
echo "#!/bin/bash -e" >> $1 | |
echo "" >> $1 | |
fi | |
} | |
edit() { | |
createScriptIfItDoesntExist $1 | |
$editor $1 | |
} | |
script=$script_root/$filename | |
edit $script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment