[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Perl: where is the command in system("command -v wget") documented?



Regid Ichira writes:
>  I am a perl beginner.  I stambled upon a perl line
>
>    if (system("command -v wget >/dev/null 2>&1") == 0)
>
>I was able to find perl's documentation for system.  But where is
>the documentation for command?

The command, command is a shell builtin. On Debian you can find 
information about it in:

$ man 7 builtins 
or
$ man 7 bash-builtins.

If you install man posix manpages:

$ sudo apt-get install manpages-posix manpages-posix-dev

You should find further information about it under 
$ man 1p command

>  Am I right that that line tests whether wget is installed in the
>system?  How does it do that?

- From the man page:

``The command utility shall cause the shell to treat the arguments  as  a
  simple command, suppressing the shell function lookup that is described
  in Command Search and Execution, item 1b.''

So, basically it will run the wget, ignoring some shell functions
and builtins. This is used often as a security measure.

/mek

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJQdGAcAAoJEPOy/bGvm8ShL1wIAOLvF4UH4Q3it2V8r7HV9llZ
ELLbq+c0mMEN8GZL1X8/pbkeQQVCe/ffDwFtPTBZSLJ/CNz0H7NtFB5jciN/oKvZ
gAhDWnerC/pA/bskb8MBu3G6J2Ofq3YkjHzqh6MN8oEiwyjKX+0E9BUVNqYuWJGJ
rzZLuUO2pZfAmfc1QF9yg2c+mxIATtCs3Hnv+PRZdW25vvK0ywaoc34aUU9A389D
75/xCR5CTzm0LJ8fPi7IdsVfUaV0lCUp3KE+DsZ9ofbRaQO1j12QrALss4cCGuxX
u9qsRBXmVmGitGi23U/RCRpfv7WPPBhZO+ilGZ8Jwhzqs4jWDZDVcjLz03AHkYM=
=kbxA
-----END PGP SIGNATURE-----


Reply to: