fix tmux bug with related session names
This commit is contained in:
parent
c3a1612b0f
commit
537e66cf20
@ -23,4 +23,4 @@ readonly session_to_attach
|
||||
|
||||
if [ -n "${session_to_attach}" ]; then
|
||||
tmux switch-client -t "${session_to_attach}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -28,7 +28,7 @@ fi
|
||||
|
||||
session="$(basename "${project_dir}" | sed 's/\./_/g')"
|
||||
|
||||
if ! tmux has-session -t "${session}" 2>/dev/null; then
|
||||
if ! tmux has-session -t="${session}" 2>/dev/null; then
|
||||
tmux new-session -d -n 1 -c "${project_dir}" -s "$(basename "${project_dir}")"
|
||||
fi
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ readonly MAINW=1
|
||||
|
||||
readonly WORKING_PROJECT="${HOME}/dotfiles"
|
||||
|
||||
if ! tmux has-session -t "${SESSION}"; then
|
||||
if ! tmux has-session -t="${SESSION}"; then
|
||||
tmux new-session -s "${SESSION}" -d -n "${MAINW}" -c "${WORKING_PROJECT}"
|
||||
tmux splitw -t "${SESSION}:${MAINW}" -d -b -h -l "${_tmux_other_pane_size}" -c '#{pane_current_path}'
|
||||
tmux send-keys -t "${SESSION}:${MAINW}.1" "git pull --rebase && git push" Enter
|
||||
|
||||
@ -7,7 +7,7 @@ readonly SESSION=example-background-job
|
||||
readonly MAINW=1
|
||||
|
||||
|
||||
if tmux has-session -t "${SESSION}" 2>/dev/null; then
|
||||
if tmux has-session -t="${SESSION}" 2>/dev/null; then
|
||||
tmux kill-session -t "${SESSION}"
|
||||
fi
|
||||
|
||||
@ -33,4 +33,4 @@ tmux kill-session -t "${SESSION}"
|
||||
EOF
|
||||
|
||||
chmod +x "${temp_script}"
|
||||
nohup "${temp_script}" >/dev/null & # run in background
|
||||
nohup "${temp_script}" >/dev/null & # run in background
|
||||
|
||||
@ -10,7 +10,7 @@ random() {
|
||||
readonly SESSION_PREFIX="sandbox"
|
||||
|
||||
SESSION="${SESSION_PREFIX}$(random)"
|
||||
while tmux has-session -t "${SESSION}" 2>/dev/null
|
||||
while tmux has-session -t="${SESSION}" 2>/dev/null
|
||||
do
|
||||
SESSION="${SESSION_PREFIX}$(random)"
|
||||
done
|
||||
@ -21,4 +21,4 @@ WORKING_PROJECT="$(mktemp -td "${SESSION}.XXXX")"
|
||||
readonly WORKING_PROJECT
|
||||
|
||||
tmux new-session -s "${SESSION}" -d -c "${WORKING_PROJECT}"
|
||||
tmux switch-client -t "${SESSION}"
|
||||
tmux switch-client -t "${SESSION}"
|
||||
|
||||
@ -27,8 +27,8 @@ fi
|
||||
SESSION="ssh_$(echo "${choosed_ssh_server%% *}" | sed 's/\./\-/g ; s/\:/\-/g')"
|
||||
|
||||
|
||||
if ! tmux has-session -t "${SESSION}" 2>/dev/null; then
|
||||
if ! tmux has-session -t="${SESSION}" 2>/dev/null; then
|
||||
tmux new-session -s "${SESSION}" -d -n "1" "TERM=xterm-256color ssh ${choosed_ssh_server} || read"
|
||||
fi
|
||||
|
||||
tmux switch-client -t "${SESSION}"
|
||||
tmux switch-client -t "${SESSION}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user