Hello please kindly solve these doubts i have about the following scripts
//Shell script that accepts arguments and prints them in reverse
echo "number of arguments"
while [ $len -ne 0 ]
eval echo \$$len
len=`expr $len - 1`
$sh test.sh a b
1.what is \$$len.what is the significance of the escape sequence
//Bundle shell script that accepts file name as arguments and create a shell script that has
the file as well as the code to recreate the
files.Thus if the script generated by your
script is executed it would recreate the original file//
echo "#to bundle ,sh this file"
for i in $*
echo "echo $i 1>&2"
echo "cat > $i <<'end of $i'"
echo " end of $i"
$sh test.sh f1 f2 >new.sh
$rm f1 f2
1.Even though the 1st line is a simple print statement if i write something difrrent i get the following error message "new.sh: line 1: to: command not found".Can u tell me why do i get this message
2.In the 4th line what does 1>&2 mean
3.Is "end of" a command and what does "<<" mean.