Genesis编程常用命令.doc_第1页
Genesis编程常用命令.doc_第2页
Genesis编程常用命令.doc_第3页
Genesis编程常用命令.doc_第4页
Genesis编程常用命令.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Genesis编程常用命令1. switch 的用法,注意每一个 case 必须要以 breaksw 结尾 否则会继续执行下一个 case 的命令 (1) 另外, $ 的意思是取得使用者的 stand input (2) echo 若加上 -n 的选项,则游标会停留在该行最后 echo -n Input one color: set STOPLIGHT = $ $n2) then echo $n1 $n2else echo $n1 $n2endif-7. 每分钟执行一次的程式# mm 等于当天时间的【分钟】数set mm = date | cut -d -f4 | cut -d: -f2if ( -r $0.out ) then rm $0.out touch $0.outelse touch $0.outendifwhile ( $mm $0.outendecho Over $0.out-8. 一个回圈的范例,并且利用 expr 去作加的动作 回圈的语法如下: foreach number (1 2 3) echo $number endset counter = 0while ($counter $file1 # 如果 $file1 没有资料,则 passing if ( -z $file1 ) then echo , $file1 is zero else cp $file1 $file rm $file1 echo , $file remove ok endif endifend# 后来看过 sed 的更进一步用法,发现先前写的太笨了,试试这个# sed /font/d $file $file1# 一次 OK, 我真是大笨蛋-11. 功能:将指定的档案中,出现第一次【回】的那一行,加上 xxxx foreach file (sky*.html) set filetitle = ftitle # 主要部份为 sed 部份 s/ */ 表示将该行第一个字元前的空白删除 echo grep 回 $file | head -1 | sed -e s/ */ $ftitle # 将刚刚那一行,再插回去 head -1 $file $filehead sed 1d $file $file1 cat $ftitle $filehead cat $file1 $filehead cp $filehead $file rm $file1 rm $ftitle rm $filehead echo $file okend-12. 一个实际建立一个 ftp server 的程式里面包括许多应用,相当有参考价值 ( 未完成 )set path = ( /usr/bin /usr/sbin )#set true = grep -c ftp /etc/passwdif ( $true = 0 ) then echo no ftp user in your system echo -n do you want to create the ftp user? set answer = $ $file1 cp $file1 $file rm $file1end-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 = dateecho Todays date is $D1 $D2 $D3if ($D1 = Mon) then echo - echo Today is $D1day $name, its time to copy your directorys! echo -else echo - echo Today is $D1day $name, no tape copies today! echo -endif-16. 一个 finger 的程式set FINGER = /usr/ucb/fingerif ( -x $FINGER ) then if ( $#argv = 0 ) then cat *.htm# rename *.html to *.htmecho -n This will change *.html to *.htm. Can I continue ? (y/n) : set input = $ *.htmlecho -n This will change *.htm to *.html. Can I continue ? (y/n) : set input = $if ( $input != y & $input != Y ) then echo 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 取代foreac

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论