From: Peter J. Holzer on
On 2007-05-01 11:22, elsiddik <elsiddik(a)> wrote:
> well i wanted to just mess a little with perl and try if it can give
> me the same result of a small shell script i wrote a little while ago
> but it doesnt seems to work out with me . here is my shell script
> #!/bin/bash
> DIRECTORY="/usr/bin"
> for file in $DIRECTORY/*
> do whatis `basename $file`
> done
> exit 0
> i tried to run a similiar perl code by typing on command line.
> perl -e "system qw (whatis /usr/bin/*)"
> but its not giving me the same whatislog - what am i doing wrong ?

Your perl script doesn't do the same thing as your shell script.

Your shell script loops over all the filenames matching /usr/bin/*,
extracting the basename of each and calling whatis with that. So if your
/usr/bin/* starts like this:


it will invoke

whatis 822-date
whatis Mail
whatis X

Your perl script just invokes the shell with the command
"whatis /usr/bin/*" (assuming qq instead of qw), which will will in turn

whatis /usr/bin/822-date /usr/bin/Mail /usr/bin/X /usr/bin/X11 ...


_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp(a) |
__/ | | -- Sam in "Freefall"