Hi friends,
Am trying to write a lil script that reverses a text file top-to-bottom. It's:
When I run this script, it just hangs (probably waiting for some more input??).....if I replace
with
it works! Why is this difference? Am I missing something in my understanding of how a command line is parsed and processed by the Shell? Please help me...would be grateful.
Thnx,
Amazator.
Am trying to write a lil script that reverses a text file top-to-bottom. It's:
Code:
#!/usr/bin/ksh
i=$(cat $1 | wc -l)
while [[ $i -ge 1 ]]
do
head -$i $1 | tail -1 >> $2
i=`expr $i - 1`
done
When I run this script, it just hangs (probably waiting for some more input??).....if I replace
Code:
head -$i ...
with
Code:
head -`echo $i` ...
it works! Why is this difference? Am I missing something in my understanding of how a command line is parsed and processed by the Shell? Please help me...would be grateful.
Thnx,
Amazator.