niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » shell
saving ksh parms
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
Kevin Rodgers
*nix forums beginner


Joined: 01 Mar 2005
Posts: 29

PostPosted: Fri Feb 18, 2005 9:55 pm    Post subject: Re: saving ksh parms Reply with quote

Michael A wrote:
Quote:
I need to save the parms in a file to be used later.
if t1 was invoked by : t1.ksh 1 2 3 4 "5 x xxx xxxx "
t2.ksh needs to read the above parms from a file and process exactly 5
parms.

In t1.ksh:
print -r - "$@" > t1.args

In t2.ksh:
IFS= read -r arg1 arg2 arg3 arg4 arg5 < t1.args

--
Kevin Rodgers
Back to top
Michael A
*nix forums beginner


Joined: 01 Mar 2005
Posts: 20

PostPosted: Fri Feb 18, 2005 5:07 pm    Post subject: Re: saving ksh parms Reply with quote

hi,

I need to save the parms in a file to be used later.
if t1 was invoked by : t1.ksh 1 2 3 4 "5 x xxx xxxx "
t2.ksh needs to read the above parms from a file and process exactly 5
parms.

thanks
Michael
Back to top
Bill Marcum
*nix forums Guru


Joined: 28 Mar 2005
Posts: 1264

PostPosted: Fri Feb 18, 2005 7:07 am    Post subject: Re: saving ksh parms Reply with quote

On 17 Feb 2005 13:32:32 -0800, Michael A
<mxa@yahoo.com> wrote:
Quote:
Hi,

what is the correct way of saving parameters of a ksh script to a file
or passing it to another script?

for example if t1.ksh and t2.ksh both use 5 parms and t2.ksh needs to
retrive saved parms from a file.

this is what I did :

t1.ksh:

cat > tmpfile.log <<eot
"$1""$2""$3""$4""$5"
eot

What if one of those parameters contains a space? Why not pass them

as parameters?

t2.ksh "$@"
Back to top
Michael A
*nix forums beginner


Joined: 01 Mar 2005
Posts: 20

PostPosted: Thu Feb 17, 2005 8:32 pm    Post subject: saving ksh parms Reply with quote

Hi,

what is the correct way of saving parameters of a ksh script to a file
or passing it to another script?

for example if t1.ksh and t2.ksh both use 5 parms and t2.ksh needs to
retrive saved parms from a file.

this is what I did :

t1.ksh:

cat > tmpfile.log <<eot
"$1""$2""$3""$4""$5"
eot

and t2.ksh:
cat tmpfile.log | read x

set - $x
echo total $#

thanks
Michael
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 12:30 am | All times are GMT
navigation Forum index » Programming » shell
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts How to specify default directory for saving files in IDLE JohnJohnUSA python 1 Tue Jul 04, 2006 6:41 am
No new posts saving variables Rainer Sigl Exim 5 Mon Jul 03, 2006 11:43 am
No new posts Saving selection in drop-down lists in PHP after page rel... dshan@web.de PHP 3 Mon Jun 19, 2006 11:37 pm
No new posts Instead of saving text files i need as html Shani python 7 Thu Jun 08, 2006 2:38 pm
No new posts saving copies of virus infected mail? Marcus Barczak Exim 1 Thu Jun 08, 2006 6:32 am

Bad Credit Credit Cards | Credit Score | Myspace Layouts | Tesco | Web Advertising
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.5892s ][ Queries: 20 (0.5180s) ][ GZIP on - Debug on ]