On unix systems one may need to know the various details of how a script is called (effective userid, command line arguments) or what environmental settings are available. The yak script can facilitate discovery of this information, by recording details of the command line arguments, environment, and standard input to a temporary file.
Example usage of the yak script.
The LPRng print server can run print jobs through filters. Many command line options are supplied, which yak can easily list to a file to assist with writing a proper print filter. Install yak locally, then add the following print queue definition to the printcap.
yak:
:client:mx=0:sh:lp=yak@%P
yak:
:server
:lp=/dev/null
:sd=/var/spool/lpd/%P
:if=/usr/local/bin/yak
Next, rebuild and restart LPRng, then send a test print job. Then investigate /tmp/yak.* for details on the environment.
# checkpc -f
Warning - changing ownership '/var/spool/lpd/yak' to 4/7
Warning - changing ownership '/var/spool/lpd/yak' to 4/7
# lpc reread all
# echo test | lpr -P yak
# cat /tmp/yak.*
To see what environment the Mac OS X StartupItems items are run in, install the YAK StartupItem into a StartupItems folder.
$ sudo tar xvzfC YAK.tar.gz /Library/StartupItems
Then, reboot the system, and look at the the /tmp/YAK.* file to see what the environment was like.