The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > UNIX Desktop for Dummies Questions & Answers
.
google unix.com



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

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-02-2009
Colel2 Colel2 is offline
Registered User
  
 

Join Date: May 2009
Posts: 4
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!
  #2 (permalink)  
Old 09-08-2009
TonyFullerMalv's Avatar
TonyFullerMalv TonyFullerMalv is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2008
Location: Malvern, Worcs. U.K.
Posts: 730
Code:
udate="/home/iclac/script_writing/2monthsago.txt"
should read:
Code:
udate=`/home/iclac/script_writing/2monthsago.txt`
By the way scripts are normally saved with a ".sh" filename suffix so others know it is a script and not a text document.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0