![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| undefined symbol: clock_gettime' error | dpa078 | High Level Programming | 4 | 04-09-2008 09:29 AM |
| undefined error | amitrajvarma | Shell Programming and Scripting | 1 | 01-11-2008 07:32 AM |
| Prompting for Input - Getting Undefined Variable | Kartheg | UNIX for Dummies Questions & Answers | 1 | 06-27-2007 05:24 PM |
| Undefined reference to Error | svh | High Level Programming | 2 | 02-11-2006 12:23 AM |
| ld: 0711-317 ERROR: Undefined symbol: .hello | stockdan | High Level Programming | 2 | 11-25-2003 05:43 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
undefined variable error
Hi all,
i have a script. When i run the script, on the prompt i use: $> . ./blah; i have an undefined variable error. But when i run the script using $> ./blah ; it works fine. I know it was something to do with FORK() process. But i have a simple script , using while loop. #!/bin/sh answer=0 while [ "$answer" -gt 10 ]; do echo "Hello" done It's complaining my "answer" variable. How to fix the problem? Do i need to use PATH? Please help |
|
||||
|
What is the difference between when it works and when it doesn't? To me they both look the same.
Your script, as copy+pasted from above, runs fine, although it never actually enters the loop, because $answer is 0. I get no complaints; and indeed, sh doesn't care whether you have explicitly defined a variable or not, and will not produce a complaint like the one you are reporting. Is it perhaps somehow being run by something else than /bin/sh? |
|
||||
|
Does actually matter to run . ./blah or ./blah
|
| Sponsored Links | ||
|
|