dos2unix.sh
#!/bin/sh foreachd () { echo $1 for file in $1/* do if [ -d $file ] then echo "directory $file" foreachd $file fi if [ -f $file ] then echo "file $file" dos2unix $file chmod -x $file fi done } echo $0 a=`echo $1` if [ $# -gt 0 ] then foreachd $a else foreachd "." fi