The script in post #10 would be much better as:
Never use a for loop for open-ended lists.
Third time this week I have seen the "cat and for" combination but I have still never seen this construct in a manual or course notes.
Still thinking about your main question because it is virtually impossible to work out what is intended from faulty code. So, general answer only:
What I usually do is the following construct:
1) Create the script "scriptname" which you want to run and make it accept parameters ($1 $2 $3 ...) and convert those parameters to the Environment Variable names required by the installation script. Ensure that the Environment Variables are exported.
2) Run the script from the su command line, complete with the parameters.
I'd only execute su - if I really wanted to execute the other user's profile. I'd rather set all the Environment Variables I need in the script itself.
Hope this helps.
Addendum: If you need to pass parameters back to the calling script, echo the parameters from the sub script and read them:
This will only work if you deal with absolutely all other output from the called script by redirection to logfiles or whatever.
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)
Hi
I want export input data ...
echo "month: "
read m
export m=$m
also export m is not working ?
the month-variable should be exportet for the use in other scripts,
but it is not working like this. What i'm doing wrong?
Thanks in advance!
IMPe (10 Replies)
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)
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)
we have a Solaris 8 nfs server that exported two shares. entries are in /etc/dfs/dfstab.
clients have been accessing these shares for several years.
we just rebooted this nfs server and noticed that no share gets exported. I don't see relevant messages from dmsg nor messages file, is there... (6 Replies)
Hi Friends,
I am presently migrating shell scripts writter in KSH to SH.I am stuck at this place and i am not able to find a work around:-
Let the script name is x.sh
Below are some of the codes in it...
export abc=hello
export abc=hi
export abc=how
When i am trying to compile the script ... (6 Replies)
I am trying to export command at shell in AIX5.3.
example: environment variable SAMPLE=test is set. after logged in to the shell, i tried to export this variavle to $ export SAMPLE=test1.
If i do $ echo $SAMPLE, it is still giving test instead of test1. what shall i do?? (1 Reply)
I am exporting data using a shell program. I am getting all of the records instead of getting a subset based on my query. The export_problem.par lists all of my tables. I tried the query with the ' and without it. How do I get the export to use the query?
Thanks!
... (1 Reply)
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)