LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Question on shell scripts (https://www.linuxquestions.org/questions/linux-newbie-8/question-on-shell-scripts-826607/)

mp_qqq 08-16-2010 03:48 PM

Question on shell scripts
 
We have Redhat linux 5.5
I am writing a very simple bash shell script which consists of the following:
------------------------------------------
MainTest.sh Shell script contents
------------------------------------------
DT_STAMP=`date +%Y%m%d%H%M`
echo $DT_STAMP
. ./pos_profile.sh
echo $LOG_FLD
LOG="$LOG_FLD$DT_STAMP.log"
echo "beforelog"
echo $LOG
echo "This is a test" > $LOG

------------------------------------------
pos_profile.sh contents
------------------------------------------
export RCD_FILE="file_name*.zip"
export LOG_FLD="/home/stage_location/"

------------------------------------------

When MainTest.sh is executed, this is the output i get
201008161546
/home/stage_location/
beforelog
201008161546.log

As you can see the LOG variable is set to only DT_STAMP.log. the value of $LOG_FLD is missing

Can somebody please help me understand what is it that I may be missing?

bigrigdriver 08-16-2010 04:46 PM

Code:

MainTest.sh Shell script contents
------------------------------------------
DT_STAMP=`date +%Y%m%d%H%M`
echo $DT_STAMP
. ./pos_profile.sh
echo $LOG_FLD
LOG="$LOG_FLD$DT_STAMP.log"

LOG_FLD is not defined.

Tinkster 08-16-2010 05:06 PM

And how (from where) are you invoking MainTest.sh?

konsolebox 08-16-2010 05:25 PM

That's a very wrong behavior. Can you directly echo "$LOG_FLD$DT_STAMP.log"?
Code:

echo "$LOG_FLD$DT_STAMP.log"


All times are GMT -5. The time now is 07:32 AM.