看板 Linux 關於我們 聯絡資訊
我有一個test_csh如下 #! /bin/csh set now_shell = "test_csh" set show_me = "inside_shell" echo "$now_shell : $show" 請問有無方法在命令列執行 test_csh 也置換變數內容 $show_me 1. 我不要$1 $2 把參數帶入 2. 我比較想要類似makefile, 如執行命令 make show_me=outside_shell -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.110.157.200 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1496329935.A.0CD.html
antontw: script 的第一行標頭就有錯吧? 06/02 12:33
rickieyang: Google: shell script arguments parsing 06/02 13:09
pili100: 是有聽過c shell,但沒用過 06/02 13:11
hijkxyzuw: LANG=c ./test_csh 06/02 21:53
hijkxyzuw: 可以設執行時的環境變數 06/02 21:53
hijkxyzuw: 例如 foo=bar sh 開一個子 shell, echo $foo 會是 bar 06/02 21:55