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 "umask"?

6 Answers   Wipro,


How can you find out how long the system has been running?

0 Answers  


i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..

0 Answers   Tech Mahindra,


What are environment variables?

2 Answers  


Why is shell scripting important?

0 Answers  






What is computer cli?

0 Answers  


What exactly is a shell?

0 Answers  


What is a file basename?

0 Answers  


why did you apply to shell

3 Answers   Shell,


c program to display the information of given file similar to givan by the unix or linux command ls -l

0 Answers   IBM,


wats the she bang statment with syntax?

3 Answers  


Where cron file kept?

2 Answers   Tech Mahindra,


Categories