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
Why are there shells on the beach?
What lives in a shell?
What is bash eval?
What happens on a system call?
What is basename in shell script?
How do I read a .sh file?
write a shell script to emulate the Id command of PRIMOS which lists files and directories. It list files first with a header FILES and then directories with a header DIRECTORIES. This command has several options. The main ones are. -file select files only -dir select directories only -reverse sort in reverse order -no_header put no header on the output -brief output the header only -size display the size of each file -help display Id´s syntax and options.
What is shell environment?
How would you compare the strings in a shell script?
I want to connect to a remote server and execute some commands, how can I achieve this?
How to set an array in linux?
What are the four fundamental components of every file system on linux?
What command needs to be used to take the backup?
Explain about "s" permission bit in a file?
Is shell a scripting language?