Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variables in shell script

Status
Not open for further replies.

rrrkrishnan

Programmer
Jan 9, 2003
107
US
I am using this command in a shell script to read the value for these variables from a file.

IFS=" "
tail -1l $HOME/extr_prd | read extr_prd_begin_dt extr_prd_end_dt

Then I use these variables in insert stmts like ,
insert into tbl
(begin_dt,
end_dt)
values
($extr_prd_begin_dt ,
$extr_prd_end_dt);

Now when I execute the shell script by just specifying the name of the shell script at shell prompt like in $shell_script_name.sh, it works fine.
But when I use nohup, like in
nohup script_name > log_file_name &
the variable substitution doesn't happen in the insert stmt.

Any help with this is much appreciated.

Thanks!!!
 
What is your output of 'tail -1 .....'. It is not work in my unix box.

tikual
 
This is the contents of the extr_prd file

EXTRACT PERIOD BEGIN DATE EXTRACT PERIOD END DATE
------------------------- -----------------------
'1900-01-01' '2003-08-31'

So I use tail -1 command to read the last line to get the values into these variables.

Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top