[Bash scipt][Linux] Read file become next stdin in a shell script
vim ttt
The entire line
1
2
3
vim qqq
echo
x=`line`
echo "I read the first line as:"
echo "<$x>"
echo
read a
read b
read c
echo "I parsed the second line as:"
echo "1st param: <$a>"
echo "2nd param: <$b>"
echo "3rd param: <$c>"
echo
happy@happy-laptop:~$ cat ttt | sh qqq
I read the first line as:
<The entire line>
I parsed the second line as:
1st param: <1>
2nd param: <2>
3rd param: <3>
Reference :
0 意見:
張貼留言