Export Variable throws message


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Export Variable throws message
# 1  
Old 05-29-2013
Export Variable throws message

Friends,

I'm trying to export a variable as follows. But getting error message "not a valid identifier". However the variable has exact value.

Code:
[root@local]# INSTSALL_PATH=/opt/tmp/Ora10.9/default
[root@local]# ORAHOME=/apps/opt/Oracle
[root@local]# export ${ORAHOME}=${INSTSALL_PATH}
-bash: export: `/apps/opt/Oracle=/opt/tmp/Ora10.9/default': not a valid identifier

I do have more than 500 lines which throws same error message. Currently i'm passing to devnull which i dont want to do.

Thanks
Bala
# 2  
Old 05-29-2013
/apps/opt/Oracle this cannot be accepted as a variable. And this is not a way to export variables.

If you want to export ORAHOME & INSTALL_PATH do it separately,
Code:
export $ORAHOME $INSTALL_PATH

# 3  
Old 05-29-2013
If this is single variable i can do it separately.

But i have similar kind of keystring and valuestring for multiple product.
# 4  
Old 05-29-2013
Do one thing,

Get all the values to be exported in a file, say exports.lst
Code:
INSTSALL_PATH=/opt/tmp/Ora10.9/default
ORAHOME=/apps/opt/Oracle

add this to your script.
Code:
. ./exports.lst
while IFS='=' read var val
do
export $var
done < ./exports.lst

what say? Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Need help export variable

Hi, Please find my code below. ps -xef | grep 14766 | awk 'BEGIN{X="java_home=";X="weblogic_home="} {for(i=1;i<=NF;i++){if($i ~ /-Dplatform\.home|java$/){split($i,P,"=");s=P?P:$i;print X""s}}}' echo "java_home="$java_home echo "weblogic_home="$weblogic_home Output: Why does... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. Shell Programming and Scripting

Can't export variable

I am relatively new to exporting variables, and I just can't seem to make this count work. What I have is the following: TOTAL=$($IMAGELIST -backupid $IM -U |gawk '{print $5}' |tail -1)|gawk '{print $6}' RESTORED=$($BPDBJOBS -most_columns -jobid $JOBS |cut -f15 -d,) |gawk '{print $6}' export... (7 Replies)
Discussion started by: newbie2010
7 Replies

3. Shell Programming and Scripting

where does variable export to?

Hi, Unix Gurus, I have a problem need help. I have a script to generate environment variable code same as following: oracle_sid=abcd export oracle_sid when I execute this code with command ./script_nane it succeeded. when I try to find it with env command or echo $oracle_sid, it does not show... (5 Replies)
Discussion started by: ken002
5 Replies

4. Shell Programming and Scripting

Export variable

Hi I have a pass a variable from one script to another. Here are my scripts Script #1 ./profile #!/bin/sh export NAME="Hello" Script #2 ./test #!/bin/sh ./profile echo $NAME when I run ./test .. i am not getting anything .. why is that? (5 Replies)
Discussion started by: arex876
5 Replies

5. Shell Programming and Scripting

Seeing variable which are exported with export

Greeting to all of you! I've small issue related to the variable which we are setting and exporting through scripts, in one of the script there are some variable used but I am not abel to get the detail as where they are set. I tried finding the detail with the help of env but no luck. ... (2 Replies)
Discussion started by: kumarmani
2 Replies

6. Shell Programming and Scripting

export variable question

simple question: for example if i use: export http_proxy=proxy:8080 and i have this script: while true; do .... lynx Google ;; wget The UNIX and Linux Forums - Learn UNIX and Linux from Experts ;; ... esac done So i must "export http_proxy=proxy:8080" before any lynx and wget... (4 Replies)
Discussion started by: aspire
4 Replies

7. Shell Programming and Scripting

Export Variable

How to export variable from one script to other? Can anybody give me syntax for that? Thanks (2 Replies)
Discussion started by: navi
2 Replies

8. UNIX for Dummies Questions & Answers

How to export the Display variable

I'm trying to open an xwindow on my Sun server. What am I doing wrong? # echo $SHELL /sbin/sh # # export DISPLAY=localhost:0.0 DISPLAY=localhost:0.0: is not an identifier Thank you! (1 Reply)
Discussion started by: FredSmith
1 Replies

9. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

10. Shell Programming and Scripting

Syntax to export any variable

How to export variables on a UNIX prompt. Please provide me syntax. Thanks in advance. Malay (5 Replies)
Discussion started by: malaymaru
5 Replies
Login or Register to Ask a Question