I am unable to read while loop in shell рукописный шрифт

So i wrote this program to повторно повернул the arguments. but the problem was while and expr command was not read by shell рукописный шрифт. Here is the program

#!/bin/sh

If test $# -eq 0

 then echo "not enough arguments "

else 
  echo " no. Of arguments is $#"

echo "the arguments are $*"

echo "the reverse of it is"

c=$#

while [ $c -ne 0 ]

do 

  eval echo \$$c

  c='expr $c - 1"

done
fi

I knew it was not reading while loop since the colour of while loop didn't change.

0
задан 2 November 2015 в 18:31

1 ответ

Я использовал бы for цикл с арифметическими выражениями удара и косвенное переменное расширение :

$ set -- a b c d e f
$ for (( c=$#; c>0; c--)); do echo ${!c}; done
f
e
d
c
b
a
0
ответ дан 30 September 2019 в 06:03

Другие вопросы по тегам:

Похожие вопросы: