Last active
April 8, 2024 04:48
-
-
Save mamemomonga/68f42f245484c321fba3f247029dd6f4 to your computer and use it in GitHub Desktop.
現在のtmuxで新しいウィンドウを開き、cdコマンドでパスを移動するスクリプト
This file contains hidden or 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/bash | |
set -eu | |
# 現在のtmuxで新しいウィンドウを開き、cdコマンドでパスを移動するスクリプト | |
if [ -z "${TMUX:-}" ]; then | |
echo "tmuxを起動してください" | |
exit 1 | |
fi | |
export TMUX | |
tmux_new_cd() { | |
local name=$1 | |
local path=$2 | |
tmux \ | |
new-window -n "$name" \;\ | |
send-keys "cd '$path'" C-m | |
} | |
# デスクトップに移動 | |
tmux_new_cd Desktop /Users/username/Desktop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment