-
-
Save ivanrad/cb99ff9e8271ac42e9e8d38a8dec4f1c to your computer and use it in GitHub Desktop.
run vim w/ sudo if necessary
This file contains hidden or 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 | |
for i; do | |
[ -e "$i" -a ! -w "$i" ] && exec sudo vim "$@" | |
done | |
exec vim "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment