LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-16-2010, 04:48 PM   #1
mp_qqq
LQ Newbie
 
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
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?
 
Old 08-16-2010, 05:46 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,896

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
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.

Last edited by bigrigdriver; 08-16-2010 at 05:48 PM.
 
Old 08-16-2010, 06:06 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
And how (from where) are you invoking MainTest.sh?
 
Old 08-16-2010, 06:25 PM   #4
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A question about shell scripts. stf92 Programming 2 08-09-2010 10:01 PM
Question regarding start-up shell scripts pjdlmack Linux - Newbie 3 10-16-2009 01:23 AM
How to ssh from a shell script ? For ppl who can write shell scripts. thefountainhead100 Programming 14 10-22-2008 07:24 AM
shell scripts newbie_m Linux - Newbie 3 01-18-2005 09:12 PM
shell scripts... roofy Linux - Newbie 13 05-06-2003 07:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration