find:warning:Unix文件名通常不包含斜杠

时间:2013-10-14 20:23:40

标签: shell unix

我写了一个shell脚本。我有个问题。 我运行我的脚本并出错 我的错误如下,

find: warning: Unix filenames usually don't contain slashes (though pathnames do).
That means that '-name 'computer/'' will probably evaluate to false all the time on this system.
You might find the '-wholename' test more useful, or perhaps '-samefile'.  
Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ `computer/''.
/behome/computer/.mozilla
/behome/computer/.mozilla/extensions
/behome/computer/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
...

1 个答案:

答案 0 :(得分:0)

由于您没有遍历树而只是专门查看这些文件夹,因此您不需要查找:

check_input_directories()
{
    if [ -d "${folder1}" ] && [ -d "${folder2}" ] ; then
        for i in ~/${folder1}/* ; do
            if [ -f ~/${folder2}/${i##*/} ] ; then
                echo ${i##*/}
            fi
        done
    fi
}