#!/bin/zsh # # make this the default shell for user tuerctl and add # the following line to sudoers file: # # tuerctl ALL=(tuer) NOPASSWD: /flash/tuer/tuer_socat.sh local TUERCHAN="sudo -u tuer /flash/tuer/tuer_socat.sh" [[ $1 == "-c" ]] && shift if [[ -z $1 ]]; then ${(z)TUERCHAN} else echo "Usable commands are: open, close, toggle, reset, status" read -d $'\n'";,& " CMD #?"> " CMD=(${=${${${CMD/;/ }/&/ }/\// }}) ${(z)TUERCHAN} <<< "${CMD[1]} ssh $1" fi