The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-19-2008
c00kie88 c00kie88 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 63
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