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 the meaning of $1 in shell script?
How can you get the value of pi till a 100 decimal places?
Explain about debugging?
Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.
What does the sh command do?
Tell something about the super block in shell scripting?
What is the first line in every perl script called?
What is mac default shell?
What is the default shell of solaris?
What is awk in shell scripting?
How to set an array in linux?
How would you compare the strings in a shell script?
Explain how you Automate your application using Shell scripting.
What's the difference between scripting and coding?
What are the different commands available to check the disk usage?