Open read only files with sudo

This commit is contained in:
Pat Regan 2011-05-18 18:16:16 -04:00
commit 69d0cb2f22

View file

@ -1,7 +1,12 @@
go() {
if [ -f "$1" ]; then
if [ -n "`file $1 | grep '\(text\|empty\|no magic\)'`" ]; then
if [ -w "$1" ]; then
$EDITOR "$1"
else
sudo $EDITOR "$1"
#echo $EDITOR /sudo::"$1" # For emacsclient+tramp
fi
else
if [ -e "`which xdg-open`" ]; then
if [ -n "$DISPLAY" ]; then