自己学习shell时候写的一个脚本:
#!/bin/csh
rm -f -r testd
mkdir testd
set cpywj = /home/user00/testd/testdf
set cpmdwj = ./testd/testdf
set i=1
set j = 0
set max=$2
while ( $i <= $max )
if ( $1 == A ) then
@ j = $i * 2 - 1
cp $cpywj $cpmdwj$j
chmod u+x $cpmdwj$j
chmod g+x $cpmdwj$j
chmod o-r $cpmdwj$j
else
@ j = $i * 2
cp $cpywj $cpmdwj$j
chmod u+x $cpmdwj$j
chmod g+x $cpmdwj$j
chmod o-r $cpmdwj$j
endif
@ i++
end