-
-
Save Zero-Fanker/158fb9825594614ed60a68a18abdd033 to your computer and use it in GitHub Desktop.
fake sudo for windows shell
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/sh | |
cmdStr="" | |
lastIsSlash=0 | |
isFirstCmd=1 | |
for cmd in $*;do | |
if [ $isFirstCmd -ne 0 ];then | |
isFirstCmd=0 | |
if [ $cmd == su ];then | |
continue | |
fi | |
if [[ $cmd == -* ]];then | |
lastIsSlash=1 | |
continue | |
fi | |
fi | |
if [ $lastIsSlash -ne 0 ];then | |
if [[ $cmd == -* ]];then | |
continue | |
else | |
lastIsSlash=0 | |
fi | |
fi | |
cmdStr="$cmdStr $cmd" | |
done | |
# echo $cmdStr | |
if [ ${#cmdStr} -ne 0 ];then | |
$cmdStr | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment