The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Local shell script need to be executed on a remote linux box rajeshomallur Linux 6 05-02-2008 02:05 PM
How to make variables in script function local? alex_5161 Shell Programming and Scripting 5 03-07-2008 02:03 PM
Reading Multiple Variables From a Single Line in Shell Drek Shell Programming and Scripting 14 12-21-2006 11:20 AM
Reading a CSV file into shell variables problem multidogzoomom Shell Programming and Scripting 6 10-11-2005 05:43 PM
Shell script to create local homes Steve Adcock Shell Programming and Scripting 11 10-25-2004 05:18 AM

Closed Thread
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
  #1 (permalink)  
Old 08-20-2001
b888c b888c is offline
Registered User
  
 

Join Date: Aug 2001
Posts: 1
Question shell script, reading and resetting local variables

Hello,

I have a problem with trying to run a shell script that reads in user input, validates, and sets to a 'default' value if the input is not valid. I cannot get the portion of resetting to a default value to work. These lines are skipped, and the
value of x is still whatever the user entered initially. Is it possible that the first x variable is not the same as the x in 'setx=10' line?

simpled version of the script

#!/bin/sh
#
echo "Enter x"
read x
echo "You entered $x"
#
# lines to validate here...
# ....
#
# I cannot get the following lines to work
set x=10
echo "x reset to $x"
  #2 (permalink)  
Old 08-20-2001
b5fnpct b5fnpct is offline
Registered User
  
 

Join Date: Aug 2001
Posts: 15
Instead of "set x=10", use "x=10" or "set x 10", you will have the right output.
Closed Thread

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:20 AM.


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