McKown, John wrote:
-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On
Behalf Of Adam Thornton
Sent: Wednesday, January 31, 2007 1:36 PM
To: LINUX-390@VM.MARIST.EDU
Subject: Re: OT: Linux and Railroad Diagrams
On Jan 31, 2007, at 1:19 PM, David Boyes wrote:
/bin/csh
cd /usr/man (note, *not* /usr/man/catman!)
foreach i (`ls -R *`) ( note backticks -- I'm sure there's a better
way,
but
what did you pay for this one? )
cat $i | troff -man | lpr -Pyourpsprinter
echo $i
end
Ew, csh.
Man pages are also to be found under /usr/share/man on Linux
systems. And /usr/local/man and /usr/local/share/man.
In sh or bash, the loop would look like:
for i in $(ls -R) ; do
echo $i
cat $i | troff -man | lpr -Pyourpsprinter
done
(And instead of backticks, $(command). $() nests, which backticks
don't.)
Adam
And just to be weird:
find . -type f | while read i;do echo "$i"; troff -man <"$i" | lpr
-Pyoupsprinter;done
Both of the previous posters get a "useless use of cat" award.
What, you've never typed the wrong angle-bracket?
Permissions can come into play too:
[EMAIL PROTECTED] ~]$ sudo ls -l /var/log/squid/access.log
-rw-r--r-- 1 squid squid 0 Jan 21 04:02 /var/log/squid/access.log
[EMAIL PROTECTED] ~]$ sudo ls -l /var/log/squid/*
/bin/ls: /var/log/squid/*: No such file or directory
[EMAIL PROTECTED] ~]$ head </var/log/squid/access.lo*
-bash: /var/log/squid/access.lo*: Permission denied
[EMAIL PROTECTED] ~]$ head </var/log/squid/access.log
-bash: /var/log/squid/access.log: Permission denied
[EMAIL PROTECTED] ~]$
and many times I find I'm wanting to change this:
grep something fromhere | ....
to something like this:
(gunzip -c *log.ga;cat *.log) | grep something
which is ease if I start with the cat.
--
Cheers
John
-- spambait
[EMAIL PROTECTED] [EMAIL PROTECTED]
Please do not reply off-list
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390