Dynamic variables within shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Dynamic variables within shell script
# 1  
Old 01-25-2007
Dynamic variables within shell script

Hi Gurus,
I have a requirement of writting the shell script where it should ask me two values

FND_TOP=/d02/app/oracle/xxx/fnd/11.5.0
CDCRM_TOP=/d02/app/oracle/xxx/cdcrm/11.5.0

and then keep these values stored as variables for the execution of rest of the script.

Because, I have to create the soft links from the values derived above.

ln -s VALUE_OF FND_TOP/fnd1 VALUE_OF_CDCRM_TOP/app_link1
ln -s VALUE_OF FND_TOP/fnd2 VALUE_OF_CDCRM_TOP/app_link2

I can't hard code the values of FND_TOP and CDCRM_top in the script, because they will change with every run.

Please help me...

TIA,
# 2  
Old 01-25-2007
echo -e "Enter the FND_TOP value : \c"
read FND
echo -e "Enter the CDCRM_TOP value : \c"
read CDCRM

now FND and CDCRM is your two variables.

you can see whether your input value is stored there by just echoing them

echo $FND
echo $CDCRM
# 3  
Old 01-25-2007
Thanks KrisshV

It worked !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

2. Shell Programming and Scripting

'Dynamic' setting of variables in bash script

Hi all, I want to dynamically set variables in a bash script. I made a naive attempt in a while loop that hopefully can clarify the idea. n=0; echo "$lst" | while read p; do n=$(($n+1)); p"$n"="$p"; done The error message is: bash: p1=line1: command not found bash: p2=line2: command... (8 Replies)
Discussion started by: jeppe83
8 Replies

3. Shell Programming and Scripting

Passing dynamic value to shell script

Hi Team, I'm using HP UX. I want to pass a variable dynamically as input while executing the script and that value need to be replaced with a string in the script. I tired SED, in the command line its working but while I keep the same command in the script its not working. Can someone help me... (4 Replies)
Discussion started by: hazel
4 Replies

4. Shell Programming and Scripting

Assigning values to reference variables for a dynamic menu driven script.

How do I assign values to reference variables? I am assigning a variable name to --> $user_var Then I am trying to change its underlying variable value by $((user_var))=$user_value .. its failing,, Please let me know if there is a way to do this dynamically.. FileA.props... (5 Replies)
Discussion started by: kchinnam
5 Replies

5. Shell Programming and Scripting

Defining Dynamic Number of Variables in a Bash Script

Code: $ cat test.bash #!/bin/bash job=$1 steps=$2 num=$(echo "$@" | wc -w) Example Submission: $ ./test.bash BS01 3 1 2 3 What: (2 Replies)
Discussion started by: mkastin
2 Replies

6. Shell Programming and Scripting

Shell script dynamic command

I need to run a shell script with dynamic command in it like # Begin script... mysql xx "select * from tab" | sed 's/\t/|/g' > GENERATED_20100304.txt the dynamic part is 20100304 which should be today's date, and it needs to run every day and create a new file with... (2 Replies)
Discussion started by: nuthalapati
2 Replies

7. Shell Programming and Scripting

dynamic editing using shell script

Hi, I would like to edit an input data-file by changing a variable in it in steps: For ex: If my input file is 'big.in', then it has the following data: 2.54 0.01 0.5 0.0 My source code then reads this above line, executes and gives out some output. Then , I want to increment... (1 Reply)
Discussion started by: habzone2007
1 Replies

8. Shell Programming and Scripting

creating dynamic shell script

Hello I am trying to create a dynamic ksh script and I have an issue. I have a script a.ksh and it has got the following lines (for example) #!/bin/ksh # trace mode +x : without trace -x : with trace set +xv echo hi, i am going to create a dynamic script now cat >> dynamic.ks <<EOF... (2 Replies)
Discussion started by: sundarkumars
2 Replies

9. Shell Programming and Scripting

Shell Script Run Interval to be dynamic

Hi All. I have a script which has to be run periodically. The frequency of its run will be decided by a Database stored value PollRate. e.g. If PollRate value is 300secs, then the script should be executed every 5 minutes, if it's 1500secs, it should execute every 15 minutes. Is there... (5 Replies)
Discussion started by: rahulrathod
5 Replies

10. Shell Programming and Scripting

search and replace dynamic data in a shell script

Hi, I have a file that looks something like this: ... 0,6,256,87,0,0,0,1187443420 0,6,438,37,0,0,0,1187443380 0,2,0,0,0,10,0,1197140320 0,3,0,0,0,10,0,1197140875 0,2,0,0,0,23,0,1197140332 0,3,0,0,0,23,0,1197140437 0,2,0,0,0,17,0,1197140447 0,3,0,0,0,17,0,1197140543... (8 Replies)
Discussion started by: csejl
8 Replies
Login or Register to Ask a Question