0
echo $BASE_DIR
PROC_NM="ALLOC$REGION"
echo $PROC_NM
BASE_LOG_DIR=`find $BASE_DIR -filename "*$PROC_NM"`
echo $BASE_LOG_DIR

returns me:

"./scripts/checkout_dcc.sh" 113L, 2642C written
bash-3.2$  ./scripts/checkout_dcc.sh 
/opt/loghome/dream/rio/drop-copy-converter/
ALLOC_JPN
find: invalid predicate `-filename'

I've tried multiple different quotes for this, but for some reason find doesn't like me using the variable for the search dir.

4

1 回答 1

1

它说这-filename不是一个有效的谓词。您需要-name,如中所述man find

$ man find | grep -ce '-filename'
0
$ man find | grep -ce '-name'
15

在那里使用变量将按预期工作:

find $BASE_DIR -name "*$PROC_NM"
于 2012-11-26T11:09:07.990 回答