Created
August 9, 2011 19:40
-
-
Save agargiulo/1134994 to your computer and use it in GitHub Desktop.
simple zsh script
This file contains 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/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