我有一個shell script要讓user輸入一個subnet網段...然後取代掉掉原先檔案內的subnet...請問該怎麼做?
user輸入:./test 192.168.1.0/24
test的內容:
#Refresh config file
SUBNET=$1
sed -e '{
s/'\"255.255.255.0\/24\"'/'\"$SUBNET\"'/g
}' /tmp/config
/tmp/config的內容:
subnet="255.255.255.0/24"
得到的結果是:
sed: -e expression #1, char 32: unknown option to `s'