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 $*
|Is This Answer Correct ?||22 Yes||7 No|
Answer / drths
$ sh rev.sh 123 ---Script name with 1 cmd line argument
abc=$1 ###123 will store in abc
pqr=`echo $pqr | rev` ### 123|rev
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|
How to take input values from the user?
write a shell script to check the failed jobs?
on “sed” command EmpData(Sample Database) 1122|j.b. saxena |g.m. |account |12/12/52|6000 2233|n.k. gupta |d.g.m |sales |31/12/40|9000 4545|anil agarwal |director |account |06/07/47|7500 5656|lalit choudhury |executive|marketing|07/09/50|5000 1265|chanchal singhvi|g.m. |admin |12/09/63|6000 0110|shyam saksena |chairman |marketing|12/12/43|8000 5566|jai sharma |director |account |23/12/89|7000 7733|jayant |d.g.m |sales |29/02/70|6000 1. From the above database substitute the delimiter of first 3 lines with “ : “ 2. From the above database substitute the delimiter with “ : ” 3. Insert the string “ XYZ Employees” in the first line. 4. Store the lines pertaining to the directors, d.g.m and g.m into three separate files. 5. Using address store first 4 lines into a file Empupdate. 6. Find the pattern “account” in the database and replaces that with “accounts”. 7. Select those lines which do not have a pattern “g.m”. 8. Insert a blank line after every line in the database.
What are the additional egrep symbols?
How to get the 3rd element/column from each line from a file?
Dear All, Can anybody tell me how to predefind no. of selected rows from a text file.
How to add some content in any file at some desired location without using VI or some other editor in UNIX
What are the advantages of bash over all other shells?
Write a shell script to check whether a number is Armstrong number or not?
Write a shell script in Linux to shift all characters in a file forward by five characters. (Thus “a” becomes “f’”).
What are the three main forms of enabling debugging in a shell script?
How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and perl scripting ( at the compile time error or run time error) in Unix environment ?