組裝可變我有以下的shell腳本,假設它的名字test.sh如何通過串
#!/bin/bash
b_x='it is the value of bx'
c_x='it is the value of cx'
case "$1" in
"b")
echo $1_x # it's doesn't work; I want to echo $b_x
;;
"c")
echo $1_x # it's doesn't work; I want to echo $c_x
;;
esac
然後我想調用腳本;
./test.sh b # I want the output is "it is the value of bx"
./test.sh c # I want the output is "it is the value of cx"
問題是什麼?你目前的產出是多少? –