23 lines
519 B
Bash
Executable file
23 lines
519 B
Bash
Executable file
#!/usr/bin/bash
|
|
|
|
HOMEDIR=~
|
|
SEL_DIR=$(find ~ -not -path "*/.*" -type d -print 2>/dev/null | fzf)
|
|
SEL_NAME=$(basename "$SEL_DIR")
|
|
|
|
if [[ -z "$SEL_DIR" ]] || [[ -n "$SEL_DIR" ]] && [[ "$SEL_DIR" == "$HOMEDIR" ]]; then
|
|
RET=0
|
|
while [[ $RET -eq 0 ]]; do
|
|
read -p "New session name: " SEL_NAME
|
|
if [[ -z "$SEL_NAME" ]]; then
|
|
clear
|
|
else
|
|
RET=1
|
|
fi
|
|
done
|
|
fi
|
|
|
|
SEL_NAME=$(tr "[:lower:]" "[:upper:]" <<< "$SEL_NAME")
|
|
|
|
tmux new-session -d -s "$SEL_NAME" -c "$SEL_DIR"
|
|
tmux switch-client -t "$SEL_NAME"
|
|
|