From: jab3 Date: 2007-01-28T01:20:37+09:00 Subject: Re: script with -e command line option??? On Friday 26 January 2007 17: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) > jab3:~% cat > wombat.txt I wish I had a fish. I wish I had a wombat. Fish are tasty. Wombats are tasty too. jab3:~% ruby -n -e "print if /wombat/" *.txt I wish I had a wombat. jab3:~% Something is screwy with your setup. Note that it is complaining that the file 'if' doesn't exist. You could try something like this and see if it works: ruby -n -e "$stdout.print if /wombat/" *.txt Why it thinks that 'if' should be a file I'm not sure about. -jab3 > $ 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? > > --su