KB#00068-Alias to print to a file and printer simultaneously
Alias to print to a file and printer simultaneously
It'll take 2 different aliases.
The first is pretty standard:
alias P1 /dev/lp1 "Std Printer" cr,lock=/tmp/lp1.lck
alias P2 ">tee $FILE >/dev/lp1" "Std/split Printer" cr,lock=/tmp/lp1.lck,FILE=/tmp/default
In the second case the same lockfile is used to manage the printer access, and the output is saved in the file named in the MODE= in the open, or in the default file /tmp/default. To use this alias use:
This method can also be done using only one ALIAS line
alias PDS "> tee -a DR/rlf_MyDiskFile$$ | lp -dlp0 > /dev/null 2>&1"
Under UNIX piping the data to a shell script may give more control and is done like this:
Setup your alias like:
alias LPF "|ptr_file" "Dual print & save in file" CR ...,lock=/tmp/LPF.lck
Then the script would be similar to the one below (a # means it's a comment line in the script):
# ptr_file - sample shell script to print to a file and printer pjw/ubb 5/7/96
# get PID of this task - use to name unique files. Use another method if you reboot often and # need to have # the files preserved long term.
# Dir to use to store files
# printer id (use $1 if you want to pass a specific ptr)
# file name
# the below simply grabs any data piped to this script & writes it to the file.
# assumes locking is handled in config.bbx
Output to the printer won't start until you have closed the channel.
Last Modified: 06/08/2006 Product: PRO/5 Operating System: All platforms
BASIS structures five components of their technology into the BBx Generations.