tuerctlsh for everyone
[svn42.git] / tuerctlsh
1 #!/bin/zsh
2 #
3 # make this the default shell for user tuerctl and add 
4 # the following line to sudoers file:
5 #
6 # tuerctl ALL=(tuer) NOPASSWD: /flash/tuer/tuer_socat.sh
7
8 local TUERCHAN="sudo -u tuer /flash/tuer/tuer_socat.sh"
9
10 [[ $1 == "-c" ]] && shift
11 if [[ -z $1 ]]; then
12   ${(z)TUERCHAN}
13 else
14   echo "Usable commands are: open, close, toggle, reset, status"
15   read -d $'\n'";,& " CMD #?"> "
16   CMD=(${=${${${CMD/;/ }/&/ }/\// }})
17   ${(z)TUERCHAN} <<< "${CMD[1]} ssh $1"
18 fi
19