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:
Then I have a shell script that I'm passing the configuration file and the interface name to as follows:
./CleanUpFiles.sh -C config.txt -P ARCHIVEPO
and here's the code in CleanUpFile.sh:
So I pass ARCHIVEPO as the value for ARCHIVE_Interface_Name parameter to CleanUpFiles.sh. When the program executes: export SOURCEDIR=${ARCHIVE_Interface_Name}SourceDir, my expectation was that it would give back the values, "/interfaces/po/log /interfaces/po/data", but instead I get back "ARCHIVEPOSourceDir". If I hard code the statement as:export SOURCEDIR=${ARCHIVEPOSourceDir}, then I correctly get back the values, "/interfaces/po/log /interfaces/po/data". I need to be able to pass it as a parameter though, because this code is going to be reused by different interfaces. Any suggestions on a way around this?
Hello,
Please see the script found in my computer below. (Ubuntu 14.04)
#!/bin/sh
export APP_DIR="/home/appname"
monitorscript="$APP_DIR""/monitor.sh"
ps cax | grep monitor.sh > /dev/null
if ; then
echo "monitor.sh is running"
else
"$monitorscript"
fi
My question is regarding EXPORT... (3 Replies)
Hi,
Will following set up work in bash script? I've got errors if assigning following binary command to a variable. But on the other hand, COMMAND="ls" works. Any explanation please? How can I assign binary command to a variable COMMAND then I can just call ${COMMAND}?
COMMAND="rsync"... (3 Replies)
shell script has a command inside back quotes in method update_TABLE
I need to store the count of number of Rows updated and store it in shell script variable "num"
num = 0;
Update_TABLE
Update_TABLE()
{
`echo " set verify off feedback off echo off pagesize 0 head off... (4 Replies)
I have a txt file from which i am assiging a value to a variable
using the code in script1
script1.sh
export f=$(sed -n "/Freq *=/ s/.*= *//p" ${R_path}/output.txt)
echo "$f" --------> this works
in script2 ( which executes the script1)
eval ./script1.sh
if && ; then
echo... (1 Reply)
I'm hoping you guys can help me out here. I've been trying different methods to try and get what IW as hoping would be a fairly simple script but has turned into a pain.
Bit of background - I am writing a script to check values in certain failes to ensure they are corerct. I'm runnign this on... (2 Replies)
I have a shell script I want to run that will set environment variables based on the value of an input variable submitted when the shell script is called. For example:
$ mgenv.sh prod
This would set environment variables for prod
$ mgenv.sh test
This would set environment variables... (1 Reply)
I'm writing a script (C shell) to search for a pattern in file. For example
scriptname pattern file1 file2 filenN
I use for loop to loop through arguments argv, and it does the job if all arguments are supplied. However if only one argument is supplied (in that case pattern ) it should ask to... (5 Replies)
I have a variable called PATH that contains a path
example: /Users/rtipton/Desktop/testusers/test
I need a sed command to set a variable called USER to the last directory name in that path
PATH="/Users/rtipton/Desktop/testusers/test"
and from that PATH i need USER to = test
I know sed... (4 Replies)
Hi all,
I want to set a variable in ksh shell (prompt) and echo the value.
$ set x=5
$echo $x
But it is returning null. Can any one please help.
Thanks in advance (1 Reply)