The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need help in storing command line argument argv[2] to a variable of int type frozensmilz High Level Programming 3 12-12-2008 11:11 AM
storing a command in a variable nookie Shell Programming and Scripting 2 10-11-2008 11:55 AM
Ksh Storing Multiple Files and reading each line in each file. developncode UNIX for Dummies Questions & Answers 1 04-08-2008 05:44 PM
Storing space delimited line in var with loop? eltinator Shell Programming and Scripting 2 08-24-2007 02:09 AM
Storing values in variable matrixmadhan Shell Programming and Scripting 1 04-01-2005 02:56 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-30-2009
yoursdavinder yoursdavinder is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 21
Storing Command Line Values

Hi,
I am trying to read the value passed by the user and store it in a variable so that later I can read it from the variable. But I am getting errors. Can you please help? Thanks.

Code:
$ECHO "Enter the Country for which you want the installation to be executed? (US/India):"
read COUNTRY
if [ "$COUNTRY" = "us" -o "$COUNTRY" = "US" ]
then
$COUNTRY="US"
else
$COUNTRY="India"
fi
$echo "The installation is for: $COUNTRY"

Execution Result:
./Country_Test.sh: line 4: Enter the Country for which you want the installation to be executed?: command not found
us
./Country_Test.sh: line 8: us=US: command not found
./Country_Test.sh: line 13: The installation is for: us: command not found
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0