我寫了一個簡單的shell script
list
--
a b c d e
run.sh
--
#!/bin/sh
str=`cat list`
for s in $str
do
echo $s
done
--
以上的動作是
將list這個檔案的字串顯示在螢幕上
但是如果照上面的作法
我的run.sh跑出來的結果會變成
a
b
c
d
e
而非
a b c d e
他把空白當作斷行看待
請問該怎麼解決這個問題呢@@"
感謝:)
--
▊ ◥ thePainter. ◤ ▎
▊ ◣◢ ◣ ◤ ◣ ◤ ▎
▊ ◥◤ ◣ ◤ ◤ ▎ http://www.wretch.cc/blog/myelf
▊ ◥ ◢ ◤ ◤ ◤ ▎ Wretch@BBS -> P_myelf
▊ ◢◤ thePainter. ◣ ▎ φthePainter.
--
list
--
a b c d e
run.sh
--
#!/bin/sh
str=`cat list`
for s in $str
do
echo $s
done
--
以上的動作是
將list這個檔案的字串顯示在螢幕上
但是如果照上面的作法
我的run.sh跑出來的結果會變成
a
b
c
d
e
而非
a b c d e
他把空白當作斷行看待
請問該怎麼解決這個問題呢@@"
感謝:)
--
▊ ◥ thePainter. ◤ ▎
▊ ◣◢ ◣ ◤ ◣ ◤ ▎
▊ ◥◤ ◣ ◤ ◤ ▎ http://www.wretch.cc/blog/myelf
▊ ◥ ◢ ◤ ◤ ◤ ▎ Wretch@BBS -> P_myelf
▊ ◢◤ thePainter. ◣ ▎ φthePainter.
--
All Comments