Skip to content

Instantly share code, notes, and snippets.

@eatnumber1
Forked from agargiulo/stuffs.zsh
Created August 10, 2011 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eatnumber1/1137594 to your computer and use it in GitHub Desktop.
Save eatnumber1/1137594 to your computer and use it in GitHub Desktop.
simple zsh script
#!/bin/zsh
emulate -L zsh
setopt err_exit
if [[ $# -ne 1 ]]; then
printf "Usage: %s session_name\n" "$0" >&2
exit 1
fi
readonly SOCKDIR="/var/run/screen/S-${USER}"
readonly SESSION_NAME="$1"
typeset -a session
session=( "$SOCKDIR"/*."$SESSION_NAME"(pN[1]) )
if ! (( ${#session} )); then
cd "$HOME"
# screen -dmS "$SESSION_NAME" -s zsh
echo no session found, starting one
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment