newfile=${oldfile// /_}
用 tr :
find . -type f -name "* *" -print |
while read name; do
na=$(echo $name | tr ' ' '_')
if [[ $name != $na ]]; then
mv "$name" $na
fi
done
修改 IFS
#!/bin/sh
IFS=@ read name address
echo "A mail to $name at $address"
read subject
echo "Subject: $subject"
or
#!/bin/sh
IFS=:
for p in $PATH
do
if [ -x $p/$1 ]
then
echo $p/$1
return
fi
done
echo "No $1 in your path" 1 > &2
return 1
or
( IFS=: ; for D in $PATH; do for F in $D/*gif*; do [ -x $F ] && echo $F; done; done )