![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| global variables in KLD (FreeBSD) | int80h | High Level Programming | 0 | 01-17-2008 08:14 PM |
| setting a global variable in script | arunkumar_mca | UNIX for Dummies Questions & Answers | 3 | 10-23-2007 08:46 AM |
| perl global variables | reggiej | Shell Programming and Scripting | 3 | 08-29-2005 09:18 AM |
| setting global variable for all users | champion | UNIX for Dummies Questions & Answers | 4 | 08-15-2002 01:59 AM |
| Global PATH setting | jxh | UNIX for Dummies Questions & Answers | 5 | 07-20-2001 06:23 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Setting global variables with BASH/Linux
I am using functions in a script and for some strange reason the EXPORT command doesnt seem to be making my variables global.
Anyone got any ideas? I am using one function to pass some output top another using the pipe command, eg Function 1 | Function 2 Function 2 reads the value passed from Function one and sets some variables based on its value then exports them setStartSeq() { read logFile echo "Start redo log: $logFile" arcPrefix=$(echo $logFile | cut -d_ -f1)"_"$(echo $logFile | cut -d_ -f2) startSeq=$(echo $logFile | cut -d_ -f3 | cut -d. -f1) export arcPrefix=$arcPrefix export startSeq=$startSeq } Yet later on in the script another function tries to use the above exported variables and they arent set!! I have confirmed that by running an export -p in the later function and all values set above are blank. I am new to BASH and Linux but have used export without issue with kornshell. Any help would be greatly appreciated ![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|