Subject: | |
From: | |
Reply To: | |
Date: | Tue, 22 Jun 1999 14:42:28 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Arthur Frank writes:
> I'm writing a command file that would accept input from a file and from the
> keyboard.
This will do what you need:
parm entry=main
if "!entry" = 'processfiles' then
setvar files finfo(HPSTDIN,'EOF')
comment write to possibly redirected $STDLIST
echo !files files were found
while setvar(files,files-1) >= 0 do
comment read from file
input file
comment write to screen
echo Process !file (Y/N)? >*out
comment read from keyboard
input answer <*in
if ups(answer) = "Y" then
echo processed! >*out
else
echo ignored! >*out
endif
endwhile
else
file in;dev=!HPLDEVIN;acc=in
file out;dev=!HPLDEVLIST;acc=out
listfile ,6 >$newpass
xeq !hpfile entry=processfiles <$oldpass
endif
The key is doing the terminal :file equates to HPLDEVIN and HPLDEVLIST before
you redirect $STDIN and/or $STDLIST. Then any I/O using the :file equates
will apply to the real terminal and not to any redirected file.
In POSIX shell scripts you can accomplish the same thing by doing your I/O
with /dev/tty if you know that stdin and/or stdout is going to be redirected.
--
Mark Bixby E-mail: [log in to unmask]
Coast Community College Dist. Web: http://www.cccd.edu/~markb/
District Information Services 1370 Adams Ave, Costa Mesa, CA, USA 92626-5429
Technical Support Voice: +1 714 438-4647
"You can tune a file system, but you can't tune a fish." - tunefs(1M)
|
|
|