Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the meaning of $1 in shell script?

1112


How can you get the value of pi till a 100 decimal places?

966


Explain about debugging?

1012


Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.

1082


What does the sh command do?

1072


Tell something about the super block in shell scripting?

1022


What is the first line in every perl script called?

1036


What is mac default shell?

1088


What is the default shell of solaris?

1038


What is awk in shell scripting?

1011


How to set an array in linux?

1209


How would you compare the strings in a shell script?

969


Explain how you Automate your application using Shell scripting.

2306


What's the difference between scripting and coding?

1166


What are the different commands available to check the disk usage?

990