參數/變數 置換 - Linux

Table of Contents


我有一個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



--

All Comments

Jake avatarJake2017-06-05
script 的第一行標頭就有錯吧?
Leila avatarLeila2017-06-07
Google: shell script arguments parsing
Dinah avatarDinah2017-06-08
是有聽過c shell,但沒用過
Adele avatarAdele2017-06-11
LANG=c ./test_csh
可以設執行時的環境變數
Donna avatarDonna2017-06-14
例如 foo=bar sh 開一個子 shell, echo $foo 會是 bar