Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
uses dmenu to go directly to a ssh host, spawn a command without a shell or open a shell directly in a working directory of another.
if test "`ls -dt $PATH "$CACHE" 2> /dev/null | sed 1q`" != "$CACHE"; then
mkdir -p "`dirname "$CACHE"`" && lsx $PATH | sort -u > "$CACHE"
choice=`awk -F'"' '/"\)/{print $2}' ~/bin/ | dmenu -p 'start:'`
case $choice in
cd $(for f in $(pidof zsh)
do echo $(ls -l /proc/$f/cwd | cut -d'>' -f2)
done | sort -u | dmenu -p 'open:') && exec $term
host=`awk '/^Host/{print $2}' ~/.ssh/config | dmenu -p 'ssh:'` && exec $term -e ssh $host
exec $term -e su -
cmd=`dmenu -p 'Window:' < "$CACHE"` && exec $cmd
cmd=`dmenu -p 'Term:' < "$CACHE"` && exec $term -e $cmd
cd $choice && exec $term
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment