From: Robert Klemme Date: 2007-01-27T07:35:09+09:00 Subject: Re: script with -e command line option??? On 26.01.2007 23:08, Suresh Unadrad wrote: > Wolfgang N�dasi-donner wrote: >> My answer is from Windows 2000, Ruby 1.8.5, but the reason may be, that >> there is >> no file in your directory which mathes "*.txt" > > no, that's not my problem. oh - but this reminds me that if i just use > something like "print" for the command line command, then it works fine: > > $ ls *.txt > test.txt > > $ more test.txt > I wish I had a fish. > I wish I had a wombat. > Fish are tasty. > Wombats are tasty too. > > $ ruby -n -e "print if /wombat/" *.txt > -e:1: No such file or directory - if (Errno::ENOENT) > > $ ruby -n -e "print if /wombat/" test.txt > -e:1: No such file or directory - if (Errno::ENOENT) > > $ ruby -n -e "print" test.txt > I wish I had a fish. > I wish I had a wombat. > Fish are tasty. > Wombats are tasty too. > > $ ruby -n -e "print" if test.txt > -e:1: No such file or directory - if (Errno::ENOENT) > > so it seems clear that ruby isn't getting the entire -e argument, > probably due to intereference by BASH. anyone know how to fix this? This looks like "ruby" was a shell script that does not properly quote arguments because ruby thinks the first word after "print" is a file name. Here you can see the effect: robert@fussel ~ $ ./aa -n -e "print if /wombat/" *.txt -e:1: No such file or directory - if (Errno::ENOENT) robert@fussel ~ $ cat aa #!/bin/sh -f ruby $* robert@fussel ~ $ Kind regards robert