Genesis2000脚本编写常用命令解析
- 格式:doc
- 大小:27.00 KB
- 文档页数:9
Genesis2000脚本命令大全1.switch的用法,注意每一个case必须要以breaksw结尾否则会继续执行下一个case的命令(1)另外,$<的意思是取得使用者的stand input(2)echo若加上-n的选项,则游标会停留在该行最后echo-n"Input one color:"set STOPLIGHT=$<switch($STOPLIGHT)case red:echo"red"breakswcase orange:echo"orange"breakswcase green:echo"green"breakswdefault:echo"you input$STOPLIGHT"endsw--------------------------------------------------------------------2.利用set来取得变数,set ABC="I am ABC"也可以利用`command`来取得命令且外,case也可以用万用字元*来代替set VER=`uname-r`switch($VER)case5.5:echo"run the setup of$VER"breakswcase5.3:echo"run the setup of$VER"breakswcase5.*:echo"like5.x"breakswcase4.*:echo"like4.x"breakswdefault:echo"no idea"endsw--------------------------------------------------------------------3.if的语法,比较数字set n1=1set n2=2if($n1==$n2)thenecho"$n1Equal$n2"elseecho"$n1Not Equal$n2"endif--------------------------------------------------------------------4.if的语法,比较字串set n1=abcdefset n2=abcdeif($n1==$n2)thenecho"$n1Equal$n2"elseecho"$n1Not Equal$n2"--------------------------------------------------------------------5.if的语法,比较相似的字串set n1=abcdefset n2=abcdeif($n1=~$n2)thenecho"$n1Like$n2"elseecho"$n1Not Like$n2"endif--------------------------------------------------------------------6.if的语法,比较数字的大小set n1=1set n2=2if($n1>$n2)thenecho"$n1>$n2"echo"$n1<$n2"endif--------------------------------------------------------------------7.每分钟执行一次的程式#mm等于当天时间的【分钟】数set mm=`date|cut-d''-f4|cut-d:-f2`if(-r$0.out)thenrm$0.outtouch$0.outelsetouch$0.outendifwhile($mm<=16)set mm=`date|cut-d''-f4|cut-d:-f2`echo"$mm now is`date`"sleep60#echo"$mm now is`date`">>$0.outendecho"Over">>$0.out--------------------------------------------------------------------8.一个回圈的范例,并且利用expr去作加的动作回圈的语法如下:foreach number(123)echo$numberendset counter=0while($counter<=10)echo"sleeping for5seconds"sleep5counter=`expr$counter+1`end--------------------------------------------------------------------9.设定一个用当天月份与日期作为档案名称的程式如今天是10/02,则$prefix会等于该程式+1002date.csh1002set prefix=`basename$0``date'+%m%d'`echo$0echo$prefix--------------------------------------------------------------------10.移除在foreach回圈内指定的档案内的font字串foreach file([b,e,g,h,s]*.html)echo-n"Processing$file,remove the line number`grep-n font $file`"#$log表示这个$file有几个font字串set log=`grep-c font$file`if($log=='0')thenecho",pass$file"else#先找出该档案的第一次出现font的行数,如果3,则$cmd=3dset cmd=`grep-n font$file|cut-d:-f1|head-1`d#利用sed去执行删除的动作,并把结果输出到${file}1sed$cmd$file>${file}1#如果${file}1没有资料,则passingif(-z${file}1)thenecho",${file}1is zero"elsecp${file}1$filerm{$file}1echo",$file remove ok"endifendifend#后来看过sed的更进一步用法,发现先前写的太笨了,试试这个#sed/font/d$file>${file}1#一次OK,我真是大笨蛋--------------------------------------------------------------------11.功能:将指定的档案中,出现第一次【回】的那一行,加上<ti tle>xxxx</title>foreach file(sky*.html)set filetitle=ftitle#主要部份为sed部份s/^*//表示将该行第一个字元前的空白删除echo"<title>`grep回$file|head-1|sed-e's/^*//'`</tit le>">$ftitle#将刚刚那一行,再插回去head-1$file>${file}headsed1d$file>${file}1cat$ftitle>>${file}headcat${file}1>>${file}headcp${file}head$filerm${file}1rm$ftitlerm${file}headecho"$file ok"end--------------------------------------------------------------------12.一个实际建立一个ftp server的程式里面包括许多应用,相当有参考价值(未完成)set path=(/usr/bin/usr/sbin)#set true=`grep-c ftp/etc/passwd`if($true==0)thenecho"no ftp user in your system"echo-n"do you want to create the ftp user?"set answer=$<if($answer=='y'||$answer=='Y')thenset maxid=`sort/etc/passwd|tail-1|cut-d:-f3`echo$maxidset newid=`expr$maxid+1`echo$newidecho"/usr/sbin/useradd-d/home1/ftp-u$newid-s/etc/false ftp"endifelseecho"Good.Your system already has the ftp user."set ftphome=`grep ftp:/etc/passwd|cut-d:-f6`echo$ftphomeendifif(-z$ftphome)thenecho"ftphome must be non-null"exit2endifif($ftphome=="/usr"||$ftphome=="/")then echo"ftphome can't be/or/usr"exit2endif#create the ftp home directoryif(!-d$ftphome)thenecho"mkdir$ftphome"endifecho"Setting up the ftphome for SunOS`uname-r`"if(!-d$ftphome)thenecho"mkdir-p$ftphome/usr/bin"endifcp/bin/ls$ftphome/usr/binchmod111$ftphome/usr/bin/lschown root$ftphome/usr/binchmod555$ftphome/usr/binif(-r$ftphome/bin)thenmv-f$ftphome/bin$ftphome/Obinendifln-s usr/bin$ftphome--------------------------------------------------------------------13.取得该使用者的UIDif($#argv==0)thenecho"$0usage:$1username"exit2endifset uid=`grep$1/etc/passwd|cut-d:-f3`echo$uid--------------------------------------------------------------------14.将指定档案内的html取代成htmforeach file(*.html)echo"Processing$file..."sed s/html/htm/$file>${file}1cp${file}1$filerm${file}1end--------------------------------------------------------------------15.一个简简单单的范例,看看就好#!/bin/csh-f echo.................echo WELCOME to\*TAPE COPY\* echo.................echo Enter your name:#$<can read from stand inputset name=$<echo""echo Hi$name\!set D=`date`echo Today\'s date is$D[1]$D[2]$D[3]if($D[1]==Mon)thenecho-------------------------------------------------------------echo Today is$D[1]day$name,it\'s time to copy your director ys\!echo-------------------------------------------------------------elseecho-------------------------------------------------------------echo Today is$D[1]day$name,no tape copies today\!echo-------------------------------------------------------------endif--------------------------------------------------------------------16.一个finger的程式set FINGER="/usr/ucb/finger"if(-x$FINGER)thenif($#argv==0)thencat<<TAG---------------------------------Hahahah....---------------------------------TAGelse$FINGER"$*"endifelseecho"Cannot find finger on this system."endif--------------------------------------------------------------------17.取得变数的方法set W=`who-r`echo$W[9]--------------------------------------------------------------------18.更改档案名称,将*.html-->*.htm#rename*.html to*.htmecho-n"This will change*.html to*.htm.Can I continue?(y/n): "set input=$<if($input!="y"&&$input!="Y")thenecho"Ok.Quit..."exit2endifforeach file(*.html)echo"Processing$file to`basename$file.html`.htm"mv$file`basename$file.html`.htmend--------------------------------------------------------------------19.更改档案名称,将*.htm-->*.htmlecho-n"This will change*.htm to*.html.Can I continue?(y/n): "set input=$<if($input!="y"&&$input!="Y")thenecho"Ok.Quit..."exit2endif#rename*.htm to*.htmlforeach file(*.htm)echo"Processing$file to`basename$file.htm`.html"mv$file`basename$file.htm`.htmlend--------------------------------------------------------------------20.将大写的档名改成小写的档名tr string1string2会将standard input的字串,所对应到的string1,都以string2取代foreach file(*)mv$file`echo$file|tr'[A-Z]''[a-z]'`end--------------------------------------------------------------------21.将小写的档名改成大写的档名foreach file(*)mv$file`echo$file|tr'[a-z]''[A-Z]'`end。
Genesis2000中常用菜单Genesis2000中常用菜单一、 EDIT1、esize:(1)GLObaL:整版改变光圈大小(2)BY Factor:按倍数放大2、Reshape:CHANGE Symbol:改变光圈大小Break:打散(把一个复杂图形打散成一个基本组成量)Break To Islands/Holes把一个含Holes的Surfaces打散成两层Line TO pad:起点与终点重合的线可转成PadClean Holes:可盖掉小的HolesFill:将surfaces的图形Fill回去(即转成用线填)3、ange:space Tracks Evenly均分线pad之间的距离4、ctions(1)hecklists :把一些分散的功能做成一个表格(2)Netlist Analyzer:网络比较(3)Select Drawn:系统自动分析可转成surfaces的file二、Analysis:分析1、surfaces Analysis:分析有问题的SURFACES2、Drill cheaks:普通钻孔分析(平面)3、signal layer checks:对层的检测4、Power/ground checks:电源层/接地层的检测5、solder mask check:阻焊层的检测6、silk screen checks:字符层检测7、Drill Checks:钻孔层检测8、SMD checks:给出SMD报告9、Pads for Drills:根据钻孔对Pads分类三、DFM1、Cleanup:(1)construe Pads(Auto)自动转换pads(2)construe pads(Ref)手动转换pads(3)set SMD Attribute:系统自动检测是否加SMD pads(定义SMD。
格式)(4)Line unification:对线的重组2、Redudancy cleanupRedundancy Line Removal:多余的线删除3、Repair(A)Pad snapping:焊盘修复(B)Pinhole Elimination:针孔(C)NecK Down Repair:线与线未完全重合处的修改4、sliver(A)sliver & Acute Angles:小空隙的修改(B)sliver & Peelable Repair:选用surfaces修改还是选用file修改(C)legend sliver fill:字符间距修复(D)Tangency Elimination:大面积铜皮上小空隙的修复四、optimization:优化(A)signal Layer opt:对层的优化(B)Line widith opt:对线优化(C)D/G opt :电源/接地层的优化(D)Solder Mask opt:对阻焊层的优化(E)Sik screen opt :字符层的优化(F)yield Improvement:Etch compensate:蚀刻补偿Advanced Teardrops Creation:加泪滴状盘copper Balancing:加假焊盘。
GENESIS2000入门教程Padup谷大pad paddn缩小pad reroute扰线路Shave削pad linedown缩线line/signal线Layer 层in 里面out外面Same layer 同一层spacing 间隙cu铜皮Other layer另一层positive 正negative负Temp 临时top顶层bot底层Soldermask绿油层silk字符层power 电源导(负片) Vcc 电源层(负片) ground 地层(负片) apply 应用solder 焊锡singnal 线路信号层soldnmask绿油层input 导入component 元器件Close 关闭zoom放大缩小create 创建Reste 重新设置corner 直角step PCB文档Center 中心snap 捕捉board 板Route 锣带repair 修理、编辑resize (编辑)放大缩小analysis 分析Sinde 边、面Advanced 高级measuer 测量PTH hole 沉铜孔NPTH hole 非沉铜孔output 导出VIA hole 导通孔smd pad 贴片PAD replace 替换fill 填充Attribute 属性round 圆square 正方形rectangle 矩形Select 选择include 包含exclude 不包含step 工作单元Reshape 改变形状profile 轮廓drill 钻带rout 锣带Actions 操作流程analyis 分析DFM 自动修改编辑circuit 线性Identify 识别translate 转换job matrix 工作室repair 修补、改正Misc 辅助层dutum point 相对原点corner 直角optimization 优化origin 零点center 中心global 全部check 检查reference layer 参考层reference selection 参考选择reverse selection 反选snap 对齐invert 正负调换symbol 元素feature 半径histogram 元素exist 存在angle 角度dimensions 标准尺寸panelization 拼图fill parameters 填充参数redundancy 沉余、清除层英文简写层属性顶层文字Top silk screen GTO silk-scren顶层阻焊Top solder mask GTS solder-mask顶层线路Top layer GTL signal内层第一层power ground (gnd) PLN2 power-ground(负片)内层第二层signal layer SIG3 signal (正片)内层第三层signal layer SIG4 signal (正片)内层第四层power ground (vcc) PLN5 power-ground(负片)外层底层bottom layer GBL signal底层阻焊bottom solder mask GBS solder-mask底层文字bottom silk screen GBO silk-scren层菜单Display ---------------------- -----当前层显示的颜色Features histogram ---------------- 当前层的图像统计Copy ---------------------- ------- 复制Merge ---------------------- ------ 合并层Unmerge ------------------- ----- 反合并层(将复合层分成正负两层)Optimize lerels ----------- ----- 层优化(当正负层太多时,要优化成最大3层)Fill profile ------------------- 填充profile(轮廓)matrix ------------------ ---- 层属性表(新建、改名、删除)copper/exposed area ----------- 计算铜面积(自动算出百分几)attribates ------------------ - 层属性(较少用)notes ------------------ ------ 记事本(较少用)clip area ------------------ - 删除区域(可自定义,或定义profile)drill tools manager ----------- 钻孔管理(改孔的属性,大小等)drill filter ------------------ 钻孔过滤hole sizes ------------------ 钻孔尺寸(在分孔图转钻孔经常用到)create drill map ------------- 利用钻孔做分孔图(如有槽孔,转出来有变)update verification coupons ---- 更新首尾孔的列表re-read ------------------ 重读文件(当文件误删时无法恢复时,可重读)truncate ------------------ 删除整层数据(无法用ctrl+z恢复)compare ------------------ 层对比(很有用,可以查看层与层之间改动过的地方)flaten ------------------ 翻转(只有在拼版里面才会出现)text reference------------------文字参考create shapelist------------------产生形状列表delete shapelist------------------删除形状列表EDIT菜单undo------------------撤消上一次操作delete------------------删除move------------------移动*copy------------------复制*resize------------------修改图形大小形状*transform------------------旋转、镜像、缩放connections------------------buffer------------------reshape------------------polarity------------------更改层的极性*cerate------------------建立*change------------------更改*attributes------------------属性edit之resizeglobal------------------所有图形元素surfaces------------------沿着表面resizc therrnals and donuts------------------散热盘及同圆contourize&resize------------------表面化及修改尺寸poly line ------------------多边形by factor------------------按照比例edit之movesame layer------------------同层移动other layer------------------移动到另一层streteh parallel lines------------------平行线伸缩orthogonal strrtch------------------平角线伸缩move triplets (fixed angele)------------------角度不变地移线(ALT+D)move triplets (fixed length)------------------长度不变地移线(ALT+J)move&to panel------------------把STEP中的图形移动到其它的STEP中same layer------------------同层移动other layer------------------移动到另一层step&repeatsame layer------------------同层移动other layer------------------同层排版edit之reshapechange symbolsame ------------------更改图形break------------------打散break to Islands/holes------------------打散特殊图形arc to lines------------------弧转线line to pad------------------线转padcontourize------------------创建铜面部件(不常用)drawn to surface------------------ 线变surfaceclean holes------------------清理空洞clean surface------------------清理surfacefill------------------填充(可以将surface以线填充)design to rout ------------------设计到rout(做锣带常用,最佳值432)substitue ------------------替代(常用,分孔图转钻孔)cutting data------------------填充成surface (常用来填充CAD数据)olarityrc direction------------------封闭区域edit之polarity(图像性质)positive------------------图像为正negative------------------图像为负invert------------------正负转换edit之ceate(建立)step------------------新建一个stepsymbol------------------新建一个symbolprofile------------------新建一个profileedit之change(更改)change text------------------更改字符串pads to slots------------------pad 变成slots (槽)space tracks evenly------------------自动平均线隙(很重要)ACTIONS菜单check lists------------------检查清单re-read ERFS------------------重读erf文件netlist analyzer------------------网络分析netlist optimization------------------网络优化output------------------输出clear selete&highlight------------------取消选择或高亮reverse seleteion---------------参考选择(很重要,有TOUCH(接触)COVERED(完全接触))script action------------------设置脚本名称selete drawn------------------选择线(一般用来选大铜皮)convert netlist to layers------------------转化网络到层notes------------------文本contour operations------------------bom view------------------surface操作seletion------------------选择attributes------------------属性graphic control------------------显示图形控制snap------------------抓取measuer------------------测量工具fill parameters------------------填充参数line parameters------------------线参数colors------------------显示颜色设置components------------------零件ANAL YSIS菜单surface analyzer------------------查找铜面部件中的问题drill checks------------------钻孔检查board-drill checks------------------查找钻孔层与补偿削铣层中潜在的工艺性缺陷signal layer checks------------------线路层检查power/ground checks------------------内层检查solder mask check------------------阻焊检查silk screen checks ------------------字符层检查profile checks------------------profile检查drill summary------------------生成padstack中的孔的统计数字,查找padtack中的最小焊环quote analysis------------------smd summary------------------对外层铜箔层执行操作,生成有关被检验层中的SMD定位和封装的统计报告orbotech AOI checks------------------microvia checks------------------ 提供HDI设计的高效钻孔分析rout layer checks------------------pads for drill------------------列出每种类型钻孔的焊盘尺寸以及焊盘的数量DFM菜单cleanup------------------redundancy cleaunp------------------repair------------------sliver------------------optimization------------------yield improvement------------------advanced------------------custom------------------legacy------------------dft------------------DFM之Cleanuplegnd detection------------------文本检测construct pads (auto)------------------自动转padconstruct pads (auto,all angles)------------------自动转pad(无论角度大小)建议不用construct pads (ref)------------------手动转pad (参照erf)DFM之redundancy cleanupaaredundant line removal------------------删除重线drawn to outline ------------------以线或轮廓来代替线绘区域减少层中的部件数量DFM之repairpad snapping------------------整体PAD对齐pinhole elimination------------------除残铜补沙眼neck down repair------------------修补未完全被其它线或焊盘覆盖的圆端或方端产生的颈锁断开(即修补未连接上的线)DFM之sliversliver´ angles------------------修补潜在加工缺陷的锐角sliver&peelable repair------------------查找修补信号层、地电层和阻焊层中的sliverlegend sliver fill------------------用于填充具有.nomenclature属性集的组件之间的sliver tangency elimination------------------DFM之optimizationsignal layer opt ------------------线路层优化line width opt------------------通过削线来达到最小值power/ground opt------------------内层优化solder mask opt------------------阻焊优化silk screen opt ------------------字符优化solder paste opt------------------锡膏优化positive plane opt ------------------DFM之yield improvementetch compansate------------------对蚀刻进行补偿、但保持CAD规范advanced teatdrops creation------------------加泪滴copper balancing------------------用于平衡铜箔分布来实现信号层上的镀覆均匀GENESIS2000常用快捷键Home 将当前图象恢复到初始状态( 等同于Ctrl + H )PageUP 扩大(Ctrl+I)PageDown 缩小(Ctrl+O)四个方向键分别向各自方向移动(配合Shift键可以实现慢移)Ctrl 跟其它键组合用,例如配合框选可以选中与框线接触的对象Shift 跟其它键组合用,例如按住Shift键不动,可用鼠标连续选中多个对象Ctrl + W 查看轮廓或骨架(有三种状态,可轮流切换)Ctrl + Z 撤消以前的操作Ctrl + X 可在按下该组合键后,再移动当前对象Ctrl + C 复制Ctrl + V 粘贴Ctrl + B 删除被选中物件Ctrl + N 查看负的对象Ctrl + S 调出抓取窗口Ctrl + I 在矩阵内可插入一行或一列(在编辑窗口可以放大)Ctrl + M 显示多于四层Ctrl + Q 框选对象后垂直或水平移动Ctrl + F 刷新Alt + G 调出控制窗口Alt + C 同层复制Alt + T 打开Transform菜单Alt + D 保持角度移动三段线的中间线Alt + L 加线的方向控制Alt + J 保持长度移动三段线的中间线Alt + O 打开Connection菜单S + A 切换抓取层S + O 关闭抓取方式S + C 抓取所选对象的中心点S + I 抓取所选对象的交叉点S + M 抓取所选对象的中点S + G 抓格点S + S 抓骨架S + E 抓边缘S + P 抓Profile双击鼠标中键取消被选的同类物件三击鼠标中键取消高亮显示状态和被选状态导入资料时,如果是这样的错误,那么查看Report,里面要是有下面那句错误提示那么就修改iol_sip-677002-Self intersecting polygon将NO改成YES,双击打开就OK了反正如果在genesis遇到这种自相交的情况,你只要把polygon选择,加个0.1mil就会修正了,修正很简单,就是把这个polygon选择,加大0.1mil,有时候你输出的时候会出现错误提示,就可以用surface 分析命令,找到那些自相交的polygon,然后选择加大1、drill数据如果是多个合在一起的话,要分为几部分并且每一部分它们对应的代码应该意义匹配,2、建立d码模版的时候,如果按照正常建立无法转换,就要考虑是否是特殊字符。
1. switch 的用法,注意每一个case 必须要以breaksw 结尾 否则会继续执行下一个case 的命令(1) 另外,$< 的意思是取得使用者的stand input(2) echo 若加上-n 的选项,则游标会停留在该行最后echo -n "Input one color: "set STOPLIGHT = $<switch ($STOPLIGHT)case red:echo "red"breakswcase orange:echo "orange"breakswcase green:echo "green"breakswdefault:echo "you input $STOPLIGHT"endsw--------------------------------------------------------------------2. 利用set 来取得变数,set ABC = "I am ABC"也可以利用`command` 来取得命令且外,case 也可以用万用字元* 来代替set VER = `uname -r`switch ($VER)case 5.5:echo "run the setup of $VER"breakswcase 5.3:echo "run the setup of $VER"breakswcase 5.*:echo "like 5.x"breakswcase 4.*:echo "like 4.x"breakswdefault:echo "no idea"endsw--------------------------------------------------------------------3. if 的语法,比较数字set n1 = 1set n2 = 2if ($n1 == $n2) thenecho "$n1 Equal $n2"elseecho "$n1 Not Equal $n2"endif--------------------------------------------------------------------4. if 的语法,比较字串set n1 = abcdefset n2 = abcdeif ($n1 == $n2) thenecho "$n1 Equal $n2"elseecho "$n1 Not Equal $n2"endif--------------------------------------------------------------------5. if 的语法,比较相似的字串set n1 = abcdefset n2 = abcdeif ($n1 =~ $n2) thenecho "$n1 Like $n2"elseecho "$n1 Not Like $n2"endif--------------------------------------------------------------------6. if 的语法,比较数字的大小set n1 = 1set n2 = 2if ($n1 > $n2) thenecho "$n1 > $n2"elseendif--------------------------------------------------------------------7. 每分钟执行一次的程式# mm 等于当天时间的【分钟】数set mm = `date | cut -d' ' -f4 | cut -d: -f2`if ( -r $0.out ) thenrm $0.outtouch $0.outelsetouch $0.outendifwhile ( $mm <= 16 )set mm = `date | cut -d' ' -f4 | cut -d: -f2`echo "$mm now is `date`"sleep 60#echo "$mm now is `date`" >> $0.outendecho "Over" >> $0.out--------------------------------------------------------------------8. 一个回圈的范例,并且利用expr 去作加的动作回圈的语法如下:foreach number (1 2 3)echo $numberendset counter = 0while ($counter <= 10)echo "sleeping for 5 seconds"sleep 5counter = `expr $counter + 1 `end--------------------------------------------------------------------9. 设定一个用当天月份与日期作为档案名称的程式如今天是10/02 , 则$prefix 会等于该程式+ 1002set prefix = `basename $0``date '+ %m%d'`echo $0echo $prefix--------------------------------------------------------------------10. 移除在foreach 回圈内指定的档案内的font 字串foreach file ([b,e,g,h,s]*.html)echo -n "Processing $file, remove the line number `grep -n font $file`"# $log 表示这个$file 有几个font 字串set log = `grep -c font $file`if ( $log == '0' ) thenecho ", pass $file"else# 先找出该档案的第一次出现font 的行数,如果3,则$cmd = 3dset cmd = `grep -n font $file | cut -d: -f1 | head -1`d# 利用sed 去执行删除的动作,并把结果输出到${file}1sed $cmd $file > ${file}1# 如果${file}1 没有资料,则passingif ( -z ${file}1 ) thenecho " , ${file}1 is zero"elsecp ${file}1 $filerm {$file}1echo " , $file remove ok"endifendifend# 后来看过sed 的更进一步用法,发现先前写的太笨了,试试这个# sed /font/d $file > ${file}1# 一次OK, 我真是大笨蛋--------------------------------------------------------------------11. 功能:将指定的档案中,出现第一次【回】的那一行,加上<title> xxxx </title>foreach file (sky*.html)set filetitle = ftitle# 主要部份为sed 部份 s/^ *// 表示将该行第一个字元前的空白删除echo "<title>`grep 回$file | head -1 | sed -e 's/^ *//'`</title>" > $ftitle# 将刚刚那一行,再插回去head -1 $file > ${file}headsed 1d $file > ${file}1cat $ftitle >> ${file}headcat ${file}1 >> ${file}headcp ${file}head $filerm ${file}1rm $ftitlerm ${file}headecho "$file ok"end--------------------------------------------------------------------12. 一个实际建立一个ftp server 的程式 里面包括许多应用,相当有参考价值( 未完成)set path = ( /usr/bin /usr/sbin )#set true = `grep -c ftp /etc/passwd`if ( $true == 0 ) thenecho "no ftp user in your system"echo -n "do you want to create the ftp user? "set answer = $<if ($answer == 'y' || $answer == 'Y') thenset maxid = `sort /etc/passwd | tail -1 | cut -d: -f3`echo $maxidset newid = `expr $maxid + 1`echo $newidecho "/usr/sbin/useradd -d /home1/ftp -u $newid -s /etc/false ftp"endifelseecho "Good. Your system already has the ftp user. "set ftphome = `grep ftp: /etc/passwd | cut -d: -f6`echo $ftphomeendifif ( -z $ftphome ) thenecho "ftphome must be non-null"exit 2endifif ( $ftphome == "/usr" || $ftphome == "/" ) thenecho "ftphome can't be / or /usr"exit 2endif# create the ftp home directoryif ( ! -d $ftphome ) thenecho "mkdir $ftphome"endifecho "Setting up the ftphome for SunOS `uname -r`"if ( ! -d $ftphome ) thenecho "mkdir -p $ftphome/usr/bin"endifcp /bin/ls $ftphome/usr/binchmod 111 $ftphome/usr/bin/lschown root $ftphome/usr/binchmod 555 $ftphome/usr/binif ( -r $ftphome/bin ) thenmv -f $ftphome/bin $ftphome/Obinendifln -s usr/bin $ftphome--------------------------------------------------------------------13. 取得该使用者的UIDif ( $#argv == 0 ) thenecho "$0 usage: $1 username"exit 2endifset uid = `grep $1 /etc/passwd | cut -d: -f3`echo $uid--------------------------------------------------------------------14. 将指定档案内的html 取代成htmforeach file ( *.html )echo "Processing $file ..."sed s/html/htm/ $file > ${file}1cp ${file}1 $filerm ${file}1end--------------------------------------------------------------------15. 一个简简单单的范例,看看就好#!/bin/csh -fecho .................echo WELCOME to \* TAPE COPY \*echo .................echo Enter your name:# $< can read from stand inputset name = $<echo " "echo Hi $name \!set D = `date`echo Today\'s date is $D[1] $D[2] $D[3]if ($D[1] == Mon) thenecho -------------------------------------------------------------echo Today is $D[1]day $name, it\'s time to copy your directorys\! echo -------------------------------------------------------------elseecho -------------------------------------------------------------echo Today is $D[1]day $name, no tape copies today\!echo -------------------------------------------------------------endif--------------------------------------------------------------------16. 一个finger 的程式set FINGER = "/usr/ucb/finger"if ( -x $FINGER ) thenif ( $#argv == 0 ) thencat << TAG---------------------------------Hahahah ....---------------------------------TAGelse$FINGER "$*"endifelseecho "Cannot find finger on this system."endif--------------------------------------------------------------------17. 取得变数的方法set W = `who -r`echo $W[9]--------------------------------------------------------------------18. 更改档案名称,将*.html --> *.htm# rename *.html to *.htmecho -n "This will change *.html to *.htm. Can I continue ? (y/n) : " set input = $<if ( $input != "y" && $input != "Y" ) thenecho "Ok. Quit..."exit 2endifforeach file ( *.html )echo "Processing $file to `basename $file .html`.htm "mv $file `basename $file .html`.htmend--------------------------------------------------------------------19. 更改档案名称,将*.htm --> *.htmlecho -n "This will change *.htm to *.html. Can I continue ? (y/n) : " set input = $<if ( $input != "y" && $input != "Y" ) thenecho "Ok. Quit..."exit 2endif# rename *.htm to *.htmlforeach file ( *.htm )echo "Processing $file to `basename $file .htm`.html " mv $file `basename $file .htm`.htmlend--------------------------------------------------------------------20. 将大写的档名改成小写的档名tr string1 string2 会将standard input 的字串,所对应到的string1, 都以string2 取代foreach file ( * )mv $file `echo $file | tr '[A-Z]' '[a-z]'`end--------------------------------------------------------------------21. 将小写的档名改成大写的档名foreach file (*)mv $file `echo $file | tr '[a-z]' '[A-Z]'`end</P< p>。
自动化阻抗制作脚本使用说明1,脚本运行环境:WINDOWS 操作系统,GENESIS8.2、GENESIS9.1、GENESIS9.2、GENESIS9.8 2,制作阻抗测试条种类。
差动阻抗(DF),特性阻抗(SE)。
3,程式运行界面和介绍。
阻抗信息显示区。
A,阻抗信息录入,首先阻搞信息,请确定录入阻抗是的状态,如果状态不对,参考资料将保证是正B.TopRefLayer : 阻抗顶层,即顶层C.BotRefLayer: 阻抗不,测试阻抗条底层。
D.ArtWorkLine :工作稿线宽。
E.ArtWorkSpacing :工作稿线距。
F.SafeCopperSpacing:阻抗线线距铜皮距离。
G.SafeCopperWidthMin:保护铜皮最小宽度。
H.Imp:阻抗值(注:此参数仅添加文字标注时用)。
I.ImpTol:阻抗公差(注:此参数仅添加文字标注时用)。
J.阻抗条宽:测试条宽度。
K.阻抗条长:阻抗条长度。
L.阻抗定位孔:阻抗定位孔左右各一个(左右距板边各1.5MM,上下居阻抗条宽中心)。
M.阻抗测试孔:阻抗测试孔大小为1.00mm。
单组阻抗信息:New:选项:新增阻抗,点击《添加阻抗参数》为新增一组阻抗值。
View选项:点击《添加阻抗参数》,自动计算阻抗组数和添加阻抗条数量,以及查看当Order组数的详细信息。
Edit选项:双击阻抗信息显示区对应ORDER对应组数如下,刚才当前为View,修改时点选EDIT,修改当前组抗条的参数,再选《添加阻抗参数》执行编辑。
所有阻抗参数添加OK后,执行《添加阻抗条》。
结果如下:。
genesis2000脚本GUI界面编写下面就是Genesis的GUI的demo程序,从里面可以学到几乎全部的GUI的功能了.前面的变量设定的部份省略不讲,大家可以参考Shell编程#!/bin/csh# This script is for GUI demo.############################################################## ####################alias gui '${GENESIS_DIR}/e${GENESIS_VER}/all/gui'alias gui_out 'echo !:* >> $GuiDefFile'alias gui_lst 'cat !:* >> $GuiDefFile'alias dogui 'gui < $GuiDefFile > $GuiDatFile; source $GuiDatFile; rm -f $GuiDefFile $GuiDatFile'if ($?GENESIS_TMP) thenset TMP = $GENESIS_TMPelse if ($?GENESIS_DIR) thenset TMP = $GENESIS_DIR/tmpelseset TMP = /genesis/tmpendif# Set gui parametersset GuiDefFile = $TMP/GuiDefFile.$$set GuiDatFile = $TMP/GuiDatFile.$$# Set fonts for gui #设定字体前三码表示字体格式,后两码数字表示大小#格式三码h 表字型(可选t) b表字宽粗体(bold)(可选m,细体) r表字正(可选i 表斜体)set TitleFont = hbr18set NormFont = hbr14set HintFont = hbi14# Set colors for gui #颜色是用RGB的型式表示,可以用Genesis中OPTION下COLOR功能来选自己喜欢的,#然后设定到GUI中去每一种颜色用两位数字表示99表示最深00表示最浅依次为R-red G-Green B-Blueset RedColor = 990000set WhiteColor = 999999set TitleColor = 772288set NormColor = 222299############################################################## #set job_list = `dbutil list jobs | awk '{print $1}'`gui_out WIN 200 200 #确定GUI窗口左上角在屏幕中的位置gui_out BG $WhiteColor #BG background背景颜色gui_out LABEL @/tmp/orblogo.xbm #添加标签(可以是一串字符,也可以是一个XPM格式图片我们在#后面会讨论如果制作这种图片,在6.如何加入中文里有说明)gui_out BG $TitleColorgui_out FG $WhiteColor #FG font ground字体颜色gui_out LABEL GUI Demogui_out BG $NormColorgui_out TEXT user_name User name : #TEXT文字输入窗口,并将值传给user_name变量, 显示”User name”gui_out DTEXT user_name Beyond Li #设定文字窗口的初始值Default TEXT=>DTEXT, 初始为Beyond Ligui_out BW 3 #BW 区隔线宽BOLD Width 设为3gui_out FORM #表格开始gui_out LABEL 'Select Job -->'gui_out LIST StepJob 5 S 1 #LIST列表选择功能StepJob为变量5表示显示5行S表示单选#多选为M, 1表示显示时从第1个项目开始显示foreach JobName ($job_list) #这里将除了genesislib以外的所有料号名都显示于LIST列表中if ($JobName != "genesislib") thengui_out $JobName #列表的内容endifendgui_out END #LIST功能结束(LIST传回的值为具体的列表中的值)gui_out ENDFORM #表格结束gui_out BW 1gui_out OPTION pnl_size Panel size: #OPTION下拉选项功能pnl_size 为变量显示”Panel size”gui_out 16x18 #选项的内容gui_out 18x24gui_out 20x24gui_out END #选项功能结束(OPTION传回的值为项目内容具体的值如16x18等)gui_out RADIO sel_pnl 'Panel name method:' H 1 $RedColor #RADIO点选功能变量为sel_p nl “’ . ’”为显示内容#H表示水平显示1表示一栏来显示最后是颜色gui_out Default #供点选的内容gui_out Keyingui_out END #点选功能结束gui_out FORM sel_pnl 2 #表格开始注意到后面有变量sel_pnl 2表示当sel_pnl选2时表格#才显现出来否则将以阴影不可编辑或选择的方式来显示gui_out TEXT pnl_name Panel name:gui_out ENDFORMgui_out CLABEL OK #按钮功能显示”OK”gui_out END #功能结束dogui #将这些传到GUI的程序中,它就会生成我们要的GUI界面.笔者通常在GUI最后,dogui之前加入一个RADIO让人员可以选择是否退出如下gui_out RADIO Exit_Chk 'Exit:' H 1 $RedColor #RADIO点选功能变量为sel_pnl “’ . ’”为显示内容#H表示水平显示1表示一栏来显示最后是颜色gui_out No #供点选的内容gui_out Yesgui_out END #点选功能结束在dogui后紧接着就设置检查if ( $Exit_Chk == 2 ) thenexit 0endif这样就可随时推出目前的GUI画面.其它的应用大家就要思考自己的工作要求,然后将这些功能灵活使用了.。
1. switch 的用法,注意每一个case 必须要以breaksw 结尾否则会继续执行下一个case 的命令(1) 另外,$< 的意思是取得使用者的stand input(2) echo 若加上-n 的选项,则游标会停留在该行最后echo -n "Input one color: "set STOPLIGHT = $<switch ($STOPLIGHT)case red:echo "red"breakswcase orange:echo "orange"breakswcase green:echo "green"breakswdefault:echo "you input $STOPLIGHT"endsw--------------------------------------------------------------------2. 利用set 来取得变数,set ABC = "I am ABC"也可以利用`command` 来取得命令且外,case 也可以用万用字元* 来代替set VER = `uname -r`switch ($VER)case 5.5:echo "run the setup of $VER"breakswcase 5.3:echo "run the setup of $VER"breakswcase 5.*:echo "like 5.x"breakswcase 4.*:echo "like 4.x"breakswdefault:echo "no idea"endsw-------------------------------------------------------------------- 3. if 的语法,比较数字set n1 = 1set n2 = 2if ($n1 == $n2) thenecho "$n1 Equal $n2"elseecho "$n1 Not Equal $n2"endif-------------------------------------------------------------------- 4. if 的语法,比较字串set n1 = abcdefset n2 = abcdeif ($n1 == $n2) thenecho "$n1 Equal $n2"elseecho "$n1 Not Equal $n2"endif-------------------------------------------------------------------- 5. if 的语法,比较相似的字串set n1 = abcdefset n2 = abcdeif ($n1 =~ $n2) thenecho "$n1 Like $n2"elseecho "$n1 Not Like $n2"endif-------------------------------------------------------------------- 6. if 的语法,比较数字的大小set n1 = 1set n2 = 2if ($n1 > $n2) thenecho "$n1 > $n2"elseecho "$n1 < $n2"endif-------------------------------------------------------------------- 7. 每分钟执行一次的程式# mm 等于当天时间的【分钟】数set mm = `date | cut -d' ' -f4 | cut -d: -f2`if ( -r $0.out ) thenrm $0.outtouch $0.outelsetouch $0.outendifwhile ( $mm <= 16 )set mm = `date | cut -d' ' -f4 | cut -d: -f2`echo "$mm now is `date`"sleep 60#echo "$mm now is `date`" >> $0.outendecho "Over" >> $0.out-------------------------------------------------------------------- 8. 一个回圈的范例,并且利用expr 去作加的动作回圈的语法如下:foreach number (1 2 3)echo $numberendset counter = 0while ($counter <= 10)echo "sleeping for 5 seconds"sleep 5counter = `expr $counter + 1 `end-------------------------------------------------------------------- 9. 设定一个用当天月份与日期作为档案名称的程式如今天是10/02 , 则$prefix 会等于该程式+ 1002date.csh1002set prefix = `basename $0``date '+ %m%d'`echo $0echo $prefix--------------------------------------------------------------------10. 移除在foreach 回圈内指定的档案内的font 字串foreach file ([b,e,g,h,s]*.html)echo -n "Processing $file, remove the line number `grep -n font $file`"# $log 表示这个$file 有几个font 字串set log = `grep -c font $file`if ( $log == '0' ) thenecho ", pass $file"else# 先找出该档案的第一次出现font 的行数,如果3,则$cmd = 3dset cmd = `grep -n font $file | cut -d: -f1 | head -1`d# 利用sed 去执行删除的动作,并把结果输出到${file}1sed $cmd $file > ${file}1# 如果${file}1 没有资料,则passingif ( -z ${file}1 ) thenecho " , ${file}1 is zero"elsecp ${file}1 $filerm {$file}1echo " , $file remove ok"endifendifend# 后来看过sed 的更进一步用法,发现先前写的太笨了,试试这个# sed /font/d $file > ${file}1# 一次OK, 我真是大笨蛋--------------------------------------------------------------------11. 功能:将指定的档案中,出现第一次【回】的那一行,加上<title> xxxx </title>foreach file (sky*.html)set filetitle = ftitle# 主要部份为sed 部份s/^ *// 表示将该行第一个字元前的空白删除echo "<title>`grep 回$file | head -1 | sed -e 's/^ *//'`</title>" > $ftitle# 将刚刚那一行,再插回去head -1 $file > ${file}headsed 1d $file > ${file}1cat $ftitle >> ${file}headcat ${file}1 >> ${file}headcp ${file}head $filerm ${file}1rm $ftitlerm ${file}headecho "$file ok"end--------------------------------------------------------------------12. 一个实际建立一个ftp server 的程式里面包括许多应用,相当有参考价值( 未完成)set path = ( /usr/bin /usr/sbin )#set true = `grep -c ftp /etc/passwd`if ( $true == 0 ) thenecho "no ftp user in your system"echo -n "do you want to create the ftp user? "set answer = $<if ($answer == 'y' || $answer == 'Y') thenset maxid = `sort /etc/passwd | tail -1 | cut -d: -f3`echo $maxidset newid = `expr $maxid + 1`echo $newidecho "/usr/sbin/useradd -d /home1/ftp -u $newid -s /etc/false ftp"endifelseecho "Good. Your system already has the ftp user. "set ftphome = `grep ftp: /etc/passwd | cut -d: -f6`echo $ftphomeendifif ( -z $ftphome ) thenecho "ftphome must be non-null"exit 2endifif ( $ftphome == "/usr" || $ftphome == "/" ) then echo "ftphome can't be / or /usr"exit 2endif# create the ftp home directoryif ( ! -d $ftphome ) thenecho "mkdir $ftphome"endifecho "Setting up the ftphome for SunOS `uname -r`"if ( ! -d $ftphome ) thenecho "mkdir -p $ftphome/usr/bin"endifcp /bin/ls $ftphome/usr/binchmod 111 $ftphome/usr/bin/lschown root $ftphome/usr/binchmod 555 $ftphome/usr/binif ( -r $ftphome/bin ) thenmv -f $ftphome/bin $ftphome/Obinendifln -s usr/bin $ftphome-------------------------------------------------------------------- 13. 取得该使用者的UIDif ( $#argv == 0 ) thenecho "$0 usage: $1 username"exit 2endifset uid = `grep $1 /etc/passwd | cut -d: -f3`echo $uid-------------------------------------------------------------------- 14. 将指定档案内的html 取代成htmforeach file ( *.html )echo "Processing $file ..."sed s/html/htm/ $file > ${file}1cp ${file}1 $filerm ${file}1end--------------------------------------------------------------------15. 一个简简单单的范例,看看就好#!/bin/csh -fecho .................echo WELCOME to \* TAPE COPY \*echo .................echo Enter your name:# $< can read from stand inputset name = $<echo " "echo Hi $name \!set D = `date`echo Today\'s date is $D[1] $D[2] $D[3]if ($D[1] == Mon) thenecho -------------------------------------------------------------echo Today is $D[1]day $name, it\'s time to copy your directorys\!echo -------------------------------------------------------------elseecho -------------------------------------------------------------echo Today is $D[1]day $name, no tape copies today\!echo -------------------------------------------------------------endif--------------------------------------------------------------------16. 一个finger 的程式set FINGER = "/usr/ucb/finger"if ( -x $FINGER ) thenif ( $#argv == 0 ) thencat << TAG---------------------------------Hahahah ....---------------------------------TAGelse$FINGER "$*"endifelseecho "Cannot find finger on this system."endif--------------------------------------------------------------------17. 取得变数的方法set W = `who -r`echo $W[9]--------------------------------------------------------------------18. 更改档案名称,将*.html --> *.htm# rename *.html to *.htmecho -n "This will change *.html to *.htm. Can I continue ? (y/n) : " set input = $<if ( $input != "y" && $input != "Y" ) thenecho "Ok. Quit..."exit 2endifforeach file ( *.html )echo "Processing $file to `basename $file .html`.htm "mv $file `basename $file .html`.htmend--------------------------------------------------------------------19. 更改档案名称,将*.htm --> *.htmlecho -n "This will change *.htm to *.html. Can I continue ? (y/n) : " set input = $<if ( $input != "y" && $input != "Y" ) thenecho "Ok. Quit..."exit 2endif# rename *.htm to *.htmlforeach file ( *.htm )echo "Processing $file to `basename $file .htm`.html "mv $file `basename $file .htm`.htmlend-------------------------------------------------------------------- 20. 将大写的档名改成小写的档名tr string1 string2 会将standard input 的字串,所对应到的string1, 都以string2 取代foreach file ( * )mv $file `echo $file | tr '[A-Z]' '[a-z]'`end-------------------------------------------------------------------- 21. 将小写的档名改成大写的档名foreach file (*)mv $file `echo $file | tr '[a-z]' '[A-Z]'`end</P< p>。