How do you print the output the same string which is typed
in command line. how do you write the shell script or
command for this. if i entered "Hello" in command line, it
should print 'Hello', if i say "Hello Welcome", i should get
the "Hello Welcome" as output.?
Answer Posted / nirmala
1)If you type "hello" in command line your script should be
written as below
echo $1
2)If you type "hello world" in command line your script
should be written as below
echo $*
3)If you type "hello" and "hello world" in cmd line and
your file name is"string" script is as written below
echo $1
shift 1
echo $*
i/p: string hello hello world
o/p:hello
hello world
| Is This Answer Correct ? | 0 Yes | 6 No |
Post New Answer View All Answers
What is shell company all about?
How to print all array elements and their respective indexes?
c program to display the information of given file similar to givan by the unix or linux command ls -l
What is bourne shell scripting?
What does egrep mean?
What is the significance of $#?
What are types of shells?
What shell is bin sh?
How do I debug a shell script?
What is shell scripting used for?
What is shift command in shell script?
How do I open the shell prompt?
Is bash a shell script?
Why are shell scripts used?
What are the different types of shell scripting?