##今天嘗試把自己使用多年的SCRIPT 移到ubuntu 10.04使用時卻遇到如標題的錯誤 "can't shift that many", 後來發現原因竟然是簡單到因為ubuntu預設的/bin/sh是symbolic link 到/bin/dash,而非/bin/bash
#!/bin/sh
if [ "$1" == "" ]; then
echo "Usage: ./lookfor.sh [file Path] -mday search_string"
echo "Usage: ./ ./lookfor.sh /opt/ -100 UCNB_PHOTOSEARCHE"
exit 1
else
temp=/tmp/lookfor$$
trap 'rm -f $temp;exit' 0 1 2 15
find $1 -mtime $2 -print > $temp
shift; shift
for word
do grep -i "$word" `cat $temp` /dev/null
done
fi
if [ "$1" == "" ]; then
echo "Usage: ./lookfor.sh [file Path] -mday search_string"
echo "Usage: ./ ./lookfor.sh /opt/ -100 UCNB_PHOTOSEARCHE"
exit 1
else
temp=/tmp/lookfor$$
trap 'rm -f $temp;exit' 0 1 2 15
find $1 -mtime $2 -print > $temp
shift; shift
for word
do grep -i "$word" `cat $temp` /dev/null
done
fi
沒有留言:
張貼留言