shell脚本

来源:互联网 发布:怎么用软件开网店 编辑:程序博客网 时间:2024/05/26 02:54

自己学习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

原创粉丝点击