Simon Krahnke
4/24/2008 12:04:00 PM
* John Maclean <jayeola@gmail.com> (12:19) schrieb:
> #why does this work?
> k.each do |x|
> p system("which #{x}")
> end
>
> # and this work
> k.each do |x|
> p system("whereis #{x}")
> end
which and whereis are real programs
> # but this doesn't
> k.each do |x|
> p system("type -p #{x}")
> end
whereas type is a shell builtin. On my system the standard shell is dash,
which doesn't recognize the -p switch.
NB: system just returns true or false, the output of the command is not
passed to ruby. Use %x for that.
mfg, simon .... l