Problem using grep through the unix shell: doesn't accept a regular expression in filename

From: Francois (merguez99_at_yahoo.fr)
Date: 11/09/04


Date: 9 Nov 2004 11:59:42 -0800

Hi,

I'm using the following simple grep command through a .sh shell
script:

#######
#\bin\bash
grep "mypattern" < $1

#######

However it works perfectly when i execute it on the command prompt by
replacing $1 by *.txt for example, but when I call the script using

myscript.sh *.txt

The *.txt only takes into account the first file matching the regular
expression and not the others! It seems quite weird, does anyone had a
similar problem?

Thanks a lot



Relevant Pages

  • Re: tell me how many specific words there are in the file?
    ... I'm trying to get the user to enter a word, then the script should ... Off the top of my head, I can't think of a grep command that will ... Am I overlooking something? ... COMPONENT EQUIVALENCY NOTICE: The subatomic particles (electrons, ...
    (comp.unix.programmer)
  • Re: Q: How to use boolean values and return codes in shell scripts?
    ... On Sat, 20 Sep 2003 at 04:19 GMT, Bernard wrote: ... > I would like to learn how to use boolean values in a script. ... > One example is the return value of a grep command as follows which ...
    (comp.os.linux.misc)
  • Re: tell me how many specific words there are in the file?
    ... Pascal Bourguignon writes: ... I'm trying to get the user to enter a word, then the script should ... Off the top of my head, I can't think of a grep command that will ... Am I overlooking something? ...
    (comp.unix.programmer)
  • Re: Grep Question
    ... In any case you think any char is making a diference in grep command, ... the string into double quotes, ... Please respond to IBM AIX Discussion List ... this...my script does not create file even after redirecting...can some ...
    (AIX-L)
  • Re: Will Linux become as vulnerable as MS ??
    ... > beeing vulnerable to viruses. ... > that they know are executable, and execute intentionally. ... >> Linux, each distro is a little different, and even within the distro, ... > Since clicking on a script is easier than typing it's name, ...
    (comp.os.linux.security)