[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
OT: shell bug?
From: |
Robert Anderson |
Subject: |
OT: shell bug? |
Date: |
Thu, 06 Mar 2003 16:13:52 -0500 |
I am running a script from two different directories and
obtaining two different behaviors, as indicated by set -x (as wel
as the results of the original program). This is the script:
#!/bin/sh -x
arch_src=$HOME/oss/dists--devo/src/arch
#prune_dirs="=later =retired =former {arch}"
prune_dirs="{arch}"
prune=
for dir in $prune_dirs; do
prune="$prune -path *${dir}* -prune -o"
done
files=`find "$arch_src" $prune -name \*.sh -print &> /dev/null`
When I run this as:
./script
it produces:
+ arch_src=/home/rwa/oss/dists--devo/src/arch
+ prune_dirs={arch}
+ prune=
+ prune= -path *{arch}* -prune -o
++ find /home/rwa/oss/dists--devo/src/arch -path '*{arch}*'
-prune -o -name '*.sh' -print
+ files=
Which is what I expect. Now I cd to another directory, and
execute using the full path:
$HOME/path/script
and I get this:
+ arch_src=/home/rwa/oss/dists--devo/src/arch
+ prune_dirs={arch}
+ prune=
+ prune= -path *{arch}* -prune -o
++ find /home/rwa/oss/dists--devo/src/arch -path '{arch}' -prune
-o -name '*.sh' -print
+ files=
+ exit 0
The same? Note quite - look at the single-quoted argument to
-path. What happened to the '*'? Your guess is as good as mine;
the one thing I'm sure of is that it changes the behavior of the
program (the real program, not the stripped down one). Any ideas
or explanations? This looks like it has to be a bug to me.
% /bin/sh --version
GNU bash, version 2.05.8(1)-release (i386-redhat-linux-gnu)
Copyright 2000 Free Software Foundation, Inc.
Bob
- OT: shell bug?,
Robert Anderson <=