|
大家好,我是一个新手,刚接触语言类。我现在用的软件里需要做一些脚本来实现很多自动化功能。但大部分都是用C SHELL写的。请问学了这个BASH可以读懂和修改CSH写的脚本吗?这两个那一个容易上手好学点,因为我们用到的可能不需要功能太强大,够用就行了。下面附上一些脚本给大家看看。这些应该是比较简单的。所以请各位给我这个初学者一个比较好的建议。谢谢。
#File naem : fastprint_outdr
#Purpose: To setup ADM to output drill layes
#Written by: Billy Chan(Orbortech Pacific)
#Pre_define variable
set delete_outline = 0
set job_name = ""
set jobname = $JOB
set drill_name = ""
set drillname = $gROWname[$matrix_counter]
#set run_drill = 0
#Define GUI window
gui_out WIN 300 200
gui_out FONT cbi24
gui_out FG $black
gui_out BG 609080
gui_out FORM
gui_out FONT cbi18
gui_out TEXT job_name 16 "The name of the job:"
gui_out DTEXT job_name $jobname
gui_out LABEL
gui_out ENDFORM
gui_out BG 609080
gui_out FORM
gui_out FONT cbi18
gui_out TEXT drill_name 16 "The name of the drill layer : "
gui_out DTEXT drill_name $drillname
gui_out LABEL
gui_out ENDFORM
gui_out FG $black
gui_out BG $white
gui_out LABEL "Need add start_end holes ?"
gui_out BG 609080
gui_out "RADIO select1 Confirm? H 1 890000"
gui_out Yes
gui_out No
gui_out END
gui_out FG $black
gui_out BG $white
gui_out LABEL "Continue output other drill layer ?"
gui_out BG 609080
gui_out "RADIO select2 Confirm? H 1 890000"
gui_out Yes
gui_out No.exit
gui_out END
gui_out FONT cbi18
gui_out BG $white
gui_out FORM
gui_out LABEL The output directory is $GENESIS_IOFILE/ldi/
gui_out ENDFORM
gui_out BG 609080
dogui
######
if ( $select2 == 2 ) then
exit
endif
#######
set seperate = "."
set lastname = "ldi"
#COM open_entity,job=$JOB,type=step,name=pnl
COM open_entity,job=$JOB,type=step,name=$STEP
set group = $COMANS
AUX set_group,group=$group
COM display_layer,name=$drill_name,display=yes,number=1
#Now we auto output the drill data to a path:
######################################################
#ADM set up
COM ncset_page_open
COM ncset_cur,job=$JOB,step=,layer=,ncset=
COM ncset_cur,job=$JOB,step=$STEP,layer=,ncset=
COM ncset_cur,job=$JOB,step=$STEP,layer=$drill_name,ncset=
VOF
COM ncset_delete,name=fp
VON
COM ncset_cur,job=$JOB,step=$STEP,layer=$drill_name,ncset=fp
COM ncd_set_machine,machine=fastprint_excellon2,thickness=0
COM ncd_auto_all,create_drill=no
####Compute values for start_end hole
# if ( $select1 == 1 ) then
# DO_INFO -t step -e $JOB/$STEP/ -d SR_LIMITS
# DO_INFO -t step -e $JOB/$STEP/ -d PROF_LIMITS
# set x1 = `echo "scale=6;$gSR_LIMITSxmin - 0.05"|bc`
# set y1 = `echo "scale=6;$gSR_LIMITSymax - 0.8"|bc`
# set x2 = `echo "scale=6;$gSR_LIMITSxmin - 0.5"|bc`
# set y2 = `echo "scale=6;$gSR_LIMITSymax - 3.5"|bc`
# set x3 = `echo "scale=6;$gSR_LIMITSxmax + 0.5"|bc`
# set y3 = `echo "scale=6;$gSR_LIMITSymin + 3.5"|bc`
# set x4 = `echo "scale=6;$gSR_LIMITSxmax + 0.05"|bc`
# set y4 = `echo "scale=6;$gSR_LIMITSymin + 0.8"|bc`
# COM ncd_start_end,split=1,start=yes,end=yes,min_dist=20,x1=$x1,y1=$y1,x2=$x2,y2=$y2
# COM ncd_end,split=1,x1=$x3,y1=$y3,x2=$x4,y2=$y4
# endif
if ( $select1 == 1 ) then
COM ncd_start_end,split=1,start=no,end=no
endif
if ( $select1 == 2 ) then
COM ncd_start_end,split=1,start=no,end=no
endif
COM ncd_register,xorigin=0,yorigin=0
COM ncd_cre_drill
#Check if directory has this drill nc file of the job or not
if ( -d $GENESIS_IOFILE/ldi/$JOB) then
rm -fr $GENESIS_IOFILE/ldi/$JOB
endif
mkdir $GENESIS_IOFILE/ldi/$JOB
#Create graphic layer for the drill layer,named d
set dirname = ".ldi"
COM ncd_ncf_export,stage=1,split=1,dir=$GENESIS_IOFILE/ldi/$JOB,name=${JOB}$dirname
if ($STATUS != 0) then
PAUSE Error - Problem outputting drill layer , check log
endif
COM ncset_page_close
chmod 777 $GENESIS_IOFILE/ldi/$JOB/*
# Create GUI to show the completed information of the ADM
gui_out WIN 300 200
gui_out FONT cbi24
gui_out FG $black
gui_out BG $light_blue
gui_out LABEL "Fast Print AUTO DRILL MANAGER SCREEN"
gui_out FONT cbi18
gui_out BG $aquamarine
gui_out FORM
gui_out LABEL "Layer drill_name was outputed to $GENESIS_IOFILE/ldi/,name is $JOB"
gui_out ENDFORM
gui_out BG $light_blue
dogui |
|