有關bash的read指令失效 - Linux

By Jacky
at 2015-10-16T11:03
at 2015-10-16T11:03
Table of Contents
我做一個search keyword in multi files Script shell
其中read 這一行無法產生作用, 也就是不能暫停迴圈, 直到我按一鍵
find "$1" -type f -iname "$2" |
while read filename
do
matchStr=$(grep -inC3 "$3" "$filename" )
if [ "$matchStr" != "" ];
then
echo "---"
echo -e "\033[00;33m$filename\033[0m"
grep -inC3 "$3" "$filename" --color
read -p "enter any key...." answer
fi
done
我懷疑第二行的read 已經改變standard io 改成從 file而不是keyboard
這是我的懷疑啦
謝謝~
--
其中read 這一行無法產生作用, 也就是不能暫停迴圈, 直到我按一鍵
find "$1" -type f -iname "$2" |
while read filename
do
matchStr=$(grep -inC3 "$3" "$filename" )
if [ "$matchStr" != "" ];
then
echo "---"
echo -e "\033[00;33m$filename\033[0m"
grep -inC3 "$3" "$filename" --color
read -p "enter any key...." answer
fi
done
我懷疑第二行的read 已經改變standard io 改成從 file而不是keyboard
這是我的懷疑啦
謝謝~
--
Tags:
Linux
All Comments

By Audriana
at 2015-10-17T17:50
at 2015-10-17T17:50

By Carolina Franco
at 2015-10-21T01:43
at 2015-10-21T01:43

By Ingrid
at 2015-10-22T12:06
at 2015-10-22T12:06

By Gary
at 2015-10-25T21:10
at 2015-10-25T21:10

By Puput
at 2015-10-27T01:46
at 2015-10-27T01:46

By Isla
at 2015-10-30T10:19
at 2015-10-30T10:19

By Gary
at 2015-11-03T11:42
at 2015-11-03T11:42

By Yuri
at 2015-11-05T14:41
at 2015-11-05T14:41
Related Posts
ubuntu 開機後沒有ctrl+alt+f2/3/4 功能

By Elizabeth
at 2015-10-14T21:22
at 2015-10-14T21:22
PHP centos freetype 載入失敗

By Jake
at 2015-10-14T16:22
at 2015-10-14T16:22
telnet客端送出指令與伺服端動作

By Donna
at 2015-10-14T13:27
at 2015-10-14T13:27
telnet客端送出指令與伺服端動作

By Una
at 2015-10-14T01:57
at 2015-10-14T01:57
關於使用usb安裝Ubuntu

By Tristan Cohan
at 2015-10-13T20:23
at 2015-10-13T20:23