write a non recursive shell script that accepts any number
of arguments and prints them in the reverse order
Answers were Sorted based on User's Feedback
Answer / naresh babu
echo "no of arguments:$#"
echo "arguments in reverse order:"
for i in $*
do
j=$i" "$j
done
echo $j
| Is This Answer Correct ? | 26 Yes | 9 No |
Answer / drths
$ sh rev.sh 123 ---Script name with 1 cmd line argument
------------------------------
#! /bin/sh
abc=$1 ###123 will store in abc
pqr=`echo $pqr | rev` ### 123|rev
echo $abc
-----------------------------
o/p : 321
| Is This Answer Correct ? | 0 Yes | 5 No |
Answer / amar
./reverse frg gh rtyh
no of arguments:3
arguments in reverse order:
rtyh gh frg
| Is This Answer Correct ? | 0 Yes | 8 No |
What does sh mean?
Explain about debugging?
What is an inode block?
write a shell script that accepts name from user and creates a directory by the path name, then creates a text file in that directory and stores in it, the data accepted from user till STOP, displays the no. of characters stored in the file.Program stops if directory name is null
What is the use of "$?" Sign in shell script?
What is the command to find out today's date?
How does path variable work?
What does echo $0 do?
Write a command sequence to find all the files modified in less than 2 days and print the record count of each.
Write down the syntax for all the loops in shell scripting.
What are the different methods available to run a shell script?
How Connect to a Database in Shell Programming?