![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX Desktop for Dummies Questions & Answers Discuss UNIX and Linux user interfaces like GNOME, KDE, CDE, and Open Office here. All UNIX and Linux Newbies Welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Embedding a command with SSH | hcclnoodles | Shell Programming and Scripting | 2 | 07-13-2008 12:49 PM |
| compare file size from a output file from a script | moustik | Shell Programming and Scripting | 7 | 11-07-2007 10:17 AM |
| Embedding xnest in C code | lesnaubr | High Level Programming | 4 | 08-13-2007 03:27 PM |
| Embedding Perl construct in ksh... | svetlur | Shell Programming and Scripting | 1 | 06-07-2007 10:39 PM |
| Output of script to a file | sumeet | UNIX for Advanced & Expert Users | 3 | 11-29-2006 12:12 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Embedding file output into a script
Hello.
I found a Unix script on this site that calculates a date that is 2 months earlier from today. I'm using that script and writing the value to a file called 2monthsago.txt. I want to use that value in another script. Below is my attempt at doing that and the results. My Script: #!/usr/bin/ksh # My attempt to run the Process Flow Maintenance scripts in lawson chmod 777 /home/iclac/script_writing/2monthsago.txt; udate=`/home/iclac/script_writing/2monthsago.txt` rdate="`date "+%m/%d/%Y"`"; #chomp($rdate); print "Run Date $rdate, Purge Thur $udate\n"; print "perl $GENDIR/bin/batch.pl MoveWorkunitToHistory move -outputFileName /apps/lawson/law/bpm/wflog/archive/pflows_move_hist.txt -processThurDate $udate\n"; Results: ucasd80:iclac:/home/iclac/script_writing# ./ProcFlow_maint /home/iclac/script_writing/2monthsago.txt: 04/30/2009: not found. **** It shows the value but I’m not sure why it reports ‘not found’ Run Date 06/01/2009, Purge Thur __________ **** It is supposed to be listing the ‘04/30/2009’ date here. perl /apps/lawson/gen/bin/batch.pl MoveWorkunitToHistory move -outputFileName /apps/lawson/law/bpm/wflog/archive/pflows_move_hist.txt -processThurDate I've also tried the udate line with double quotes and then no quotes. When I do that it reports the sting as the value - see below. Code: udate="/home/iclac/script_writing/2monthsago.txt" Results: Run Date 06/02/2009, Purge Thur /home/iclac/script_writing/2monthsago.txt Any thoughts on what I'm doing wrong. Signed: Utterly confused aka Leslie -----Post Update----- With the help of a co-worker we got it working. I needed to change my udate line from the above to what's listed below: udate=`cat /home/iclac/script_writing/2monthsago.txt`; It now works like a charm. Thanks! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|