我試着寫bash腳本,包含TMUX命令:在Tmux腳本中使用參數?
#!/bin/bash
# script.sh
tmux -2 new-session -s name 'another_script.sh param'
#!/bin/bash
# another_script.sh
echo $1 > test
這將是好的,如果another_script.sh
已經用硬編碼參數值的方式執行
tmux -2 new-session -s name 'another_script.sh param_value'
但是,當我「M試圖用一個可變$1
未被傳遞到參數的
tmux -2 new-session -s name 'another_script.sh $1'
值
有人知道我在做什麼錯嗎?
你確定,它不是'他們是不同的 – BMW