Why is bash not behaving consistently?
Paul Howarth
paul at city-fan.org
Fri Aug 12 08:37:42 UTC 2005
Dan Track wrote:
> I was writing this little bash script using find and I came along this
> difference from using the same command on the command line and in bash
> script.
>
> Basically on the command line I have to type:
>
> /usr/bin/find /opt/yum/packages/ -mtime +2 -a \( -regex .*.rpm -o
> -regex .*.hdr \) -exec ls -lrt {} \;
>
> whereas , in a bash script I have to type:
>
> /usr/bin/find /opt/yum/packages/ -mtime +2 -a ( -regex .*.rpm -o
> -regex .*.hdr ) -exec ls -lrt {} ;
>
> As you can see I need to escape parenthesis and semi-colons on the
> command line but I don't need to do that in a bash script.
>
> Is there a reason for this?
How are you running this script? I would expect the first version to
work on the command-line and in a script, and the second version not to
work at all...
Paul.
More information about the fedora-list
mailing list