Computing.Net > Forums > Unix > Variables in Shell SCripting

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Variables in Shell SCripting

Reply to Message Icon

Name: pmjain
Date: February 26, 2004 at 22:14:10 Pacific
OS: UNIX/Window
CPU/Ram: ----
Comment:

Shell Scripting -- Variables
In the main script i have exported the variable and accessing it in another file
but when i echo the value the value of the exported variable is not viewable .
below are the scripts . can anyone let me know whats wrong with the following script

main script looks like
----
. ./functions.sh
export SCRIPT_NAME
SCRIPT_NAME=testing.sh
----
functions.sh looks like as below
----
OUTPUT_DIR=/export/shalini/
OUTPUT_FILE=$SCRIPT_NAME
OUTPUT=${OUTPUT_DIR}/${OUTPUT_FILE}

echo $OUTPUT
echo $SCRIPT_NAME
start_time()
{
//function detials
}



Sponsored Link
Ads by Google

Response Number 1
Name: aigles
Date: February 27, 2004 at 01:33:32 Pacific
Reply:

The variable SCRIPT_NAME is not yet set when you try to use it in 'function.sh' (you define it after sourcing 'function.sh'.

Main script:
----
export SCRIPT_NAME=testing.sh
. ./functions.sh


Jean-Pierre.


0

Response Number 2
Name: pmjain
Date: February 27, 2004 at 01:40:41 Pacific
Reply:

Thanks a lot for your help Jean-Pierre


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Variables in Shell SCripting

awk variables in shell script www.computing.net/answers/unix/awk-variables-in-shell-script/6201.html

use variable of shell script in awk www.computing.net/answers/unix/use-variable-of-shell-script-in-awk/4570.html

Compare two variables in shell script www.computing.net/answers/unix/compare-two-variables-in-shell-script-/3611.html