Skip to content

Instantly share code, notes, and snippets.

@Tschrock
Created July 30, 2014 07:10
Show Gist options
  • Save Tschrock/99b320640a1a415e15c9 to your computer and use it in GitHub Desktop.
Save Tschrock/99b320640a1a415e15c9 to your computer and use it in GitHub Desktop.
Some shell scripts to make my life easier.
#!/bin/bash
if [[ -w $1 ]]; then
nano $@
else
sudo nano $@
fi
#!/bin/bash
if [[ -f $1 ]]; then
snano $@
else
if [[ -w $(basename $1) ]]; then
xnano $@
else
sudo xnano $@
fi
fi
#!/bin/bash
if [[ ! -f $1 ]]; then
touch $1 && chmod +x $1 && echo "#!/bin/bash" > $1 && nano $1
else
nano $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment