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

How does ls command work?

972


What is web script?

1029


What shell is bin sh?

904


How do I open the shell in cmd?

1046


How to print the first array element?

979


What is shell prompt?

950


What are the types of script?

1089


What is the default ubuntu terminal?

1050


Is shell scripting difficult?

890


Explain how you Automate your application using Shell scripting.

2245


is this growing field and what is average package in this?

2243


Write a script to print the first 10 elements of fibonacci series.

2278


c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l

3696


Write down the syntax for all the loops in shell scripting.

1076


What is .sh file in mac?

972