| Author |
Message |
Kevin Rodgers *nix forums beginner
Joined: 01 Mar 2005
Posts: 29
|
Posted: Fri Feb 18, 2005 9:55 pm Post subject:
Re: saving ksh parms
|
|
|
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
|
Posted: Fri Feb 18, 2005 5:07 pm Post subject:
Re: saving ksh parms
|
|
|
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
|
Posted: Fri Feb 18, 2005 7:07 am Post subject:
Re: saving ksh parms
|
|
|
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
|
Posted: Thu Feb 17, 2005 8:32 pm Post subject:
saving ksh parms
|
|
|
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 |
|
 |
|