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
How will you copy a file from one machine to other?
What is the command to find out users on the system?
How will you find the 99th line of a file using only tail and head command?
What is the use of "$#" in shell scripting?
How to get the first line from a file using just the terminal?
How do I set bash as default shell mac?
What command needs to be used to take the backup?
Differentiate between ‘ and ” quotes.
What is eval in shell script?
How to print the first array element?
Determine the output of the following command: [ -z “” ] && echo 0 || echo 1
What does .sh file contain?
How are shells born?
Can you write a script to portray how set –x works?
What are scripts in psychology?