From: "A. Mahendra Rajah" <Mahendra.Rajah@URegina.CA>
Subject: SUMMARY: exec statement to open an input file
Date: Thu, 24 Mar 2005 17:27:10 -0600 (CST) [thread overview]
Message-ID: <01LMA00C8QB28WW4WD@Eason.cc.uregina.ca> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; CHARSET=US-ASCII, Size: 1247 bytes --]
I asked:
...........................................................
When the I/O unit is a variable, the exec statement fails
as follows:
k=4
set -xv
exec ${k}< File25.dat
+ exec 4
+ 0< File25.dat
ask.shl[11]: 4: not found
How can one use variables in the exec statement to open files?
...........................................................
Thanks to
william f fiore jr
Mathias Schmassmann
Bård Tesaker
for replying.
Mathias suggested:
I think the exec I/O redirection syntax using a variable
requires that the variable includes the I/O redirection
operator "<". Maybe you can try the following statement:
k="4<"
eval exec ${k} File25.dat
This worked. Thanks.
-- mahendra
.................................................................
A. Mahendra Rajah Email: Mahendra.Rajah@URegina.CA
Tru64 UNIX Systems Manager Phone: (306) 585-4496
Dept. of Computing Services FAX: (306) 337-2324
University of Regina,
Regina, Sask., S4S 0A2
Canada.
.................................................................
reply other threads:[~2005-03-24 23:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox