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 are "c" and "b" permission fields of a file?
What is the significance of $#?
How to print all array elements and their respective indexes?
determine the output of the following command: echo ${new:-variable}
What is scripting used for?
Explain about shebang?
How can you get the value of pi till a 100 decimal places?
What is web script?
What is a scripting language simple definition?
How do I run a shell script in powershell?
What is the difference between bash and shell?
What is console line?
Why are shell scripts used?
c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command
What are the 3 standard streams in linux?