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.?

Answers were Sorted based on User's Feedback



How do you print the output the same string which is typed in command line. how do you write the sh..

Answer / santana20142003

$read line ---> it will read
$ echo $line ---> it will display

Is This Answer Correct ?    6 Yes 0 No

How do you print the output the same string which is typed in command line. how do you write the sh..

Answer / asit

echo "$*"

Is This Answer Correct ?    1 Yes 0 No

How do you print the output the same string which is typed in command line. how do you write the sh..

Answer / 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

More Shell Script Interview Questions

What is wc in shell script?

0 Answers  


In which variable prompt value is stored?

2 Answers  


shell script for reverse the string

0 Answers  


Why do we use shell scripting?

0 Answers  


What is bash eval?

0 Answers  


How will you list only the empty lines in a file (using grep)?

4 Answers   ANZ,


Explain about gui scripting?

0 Answers  


What does .sh file contain?

0 Answers  


How important is shell scripting?

0 Answers  


What is console line?

0 Answers  


What is the first line in every perl script called?

0 Answers  


Print the 10th line without using tail and head command.

0 Answers  


Categories