Wednesday, April 9, 2008

blank in shell script

Try to avoid the use of blank in pathnames. It will drive you crazy under some circumstances. Take the following script as an example.

#!/bin/sh
opt="-path \"*/a bc\" -prune"
find $opt -o -print0
bash -c "find $opt -o -print0"

find $opt -o -print0 does not work. But bash -c "find $opt -o -print0" works. I have tried very hard to find a way to make the former work. But I failed. I will be happy to hear if anybody has a solution.

No comments: