已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
QUOTE:1. for i in ls *.mp3for i in ls *.mp3; do? ?# Wrong!for.in 01 - Dont Eat the Yellow Snow.mp3 i 01-Dontls *.mp3for i in ls *.mp3; do? ?# Wrong!for i in *.mp3; do2. cp $file $target cp $file $target - cp cp - $file $target - for i in ./*.mp3; do?cp $i /target?.3. $foo = bar $foo = bar $foo multiple words here = bar $foo = bar ? ? ?# $foo - bash $foo = bar ? ? ?# bash x$foo = xbar ? ? # Java bar = $foo ? ? ?# 4. cd dirname $fcd dirname $fdirname Cbash $()cd $(dirname $f)5. $foo = bar & $bar = foo & test & bar = $foo -a foo = $bar ? ? ? # Right! bar = $foo & foo = $bar ? ?# Also right! $foo = bar & $bar = foo ? ? ? ?# Also right!6. $foo 7 ( $foo 7 ) $foo -gt 7 -gt $foo $foo -gt 7 7. grep foo bar | while read line; do (count+) ); done grep foo bar | while read line; do (count+); done? ? ? ?# barfoogrep -c foo bar grep foo bar | wc -lcountshellshell count8. if grep foo myfile if if test if Cif if then if grep foo myfile /dev/null; then9. if bar=$foo if if bar = $foo 10. if a = b & c = d if Cif a = b & c = d ? ? ?# 11. cat file | sed s/foo/bar/ file file0mv sed s/foo/bar/g file tmpfile & mv tmpfile file12. echo $fooMSG=Please enter a file name of the form *.zipecho $MSG? ? ? ?# zipPlease enter a file name of the form freenfss.zip lw35nfss.zipecho13. $foo=bar $ PerlPHP14. foo = barC15. echo EOFhere documenthere documentcatecho# This is wrong:echo EOFHello worldEOF# This is right:cat 7 ( $foo 7 ) $foo -gt 7 -gt $foo $foo -gt 7 7. grep foo bar | while read line; do (count+) ); done grep foo bar | while read line; do (count+); done? ? ? ?# barfoogrep -c foo bar grep foo bar | wc -lcountshellshell count8. if grep foo myfile if if test if Cif if then if grep foo myfile /dev/null; then9. if bar=$foo if if bar = $foo 10. if a = b & c = d if Cif a = b & c = d ? ? ?# 11. cat file | sed s/foo/bar/ file file0 mvsed s/foo/bar/g file tmpfile & mv tmpfile file12. echo $fooMSG=Please enter a file name of the form *.zipecho $MSG? ? ? ?# zipPlease enter a file name of the form freenfss.zip lw35nfss.zip echo13. $foo=bar $ PerlPHP14. foo = barC15. echo EOFhere documenthere documentcatecho# This is wrong:echo EOFHello worldEOF# This is right:cat EOFHello worldEOF16. su -c some command -c some command shell su -c su some command shellsu root -c some command man su -c - c, -commmand=COMMAND? ? ? ? ?pass a single COMMAND to the shell with -c -c some command -c some command shell17. cd /foo; barcd bar cdcd /foo & bar cd |cd /foo | exit 1;barbaz shellfind . -type d | while read subdir; do?cd $subdir & whatever & . & cd -done find . -type d | while read subdir; do?(cd $subdir & whatever & .)done shellshellshellshellcd - pushdpopddirs 18. bar = $foo = bar = $foo & echo yes bar = $foo & echo yes19. for i in 1.10; do ./something &; done& ; & ;for i in 1.10; do ./something & done20. cmd1 & cmd2 | cmd3 if.then.else cmd2cmd3 if cmd1; then cmd2; else cmd3 21. UTF-8BOM(Byte-Order Marks)UTF-8 BOMUnixUTF-8BOMBOMshell #!/bin/sh MS-DOS(CRLF)shell DOS$ ./dos-bash: ./dos: /bin/shM: bad interpreter: No such file or directory22. echo Hello World!- bash: !: event not found ! shell!$ echo hi!hi! $ echo Hello, world! set +H set +Hecho Hello, world!23. for arg in $*$*#!/bin/bash# Incorrect versionfor x in $*; do?echo parameter: $xdone$ ./myscript arg 1 arg2 arg3parameter: argparameter: 1parameter: arg2parameter: arg3 $#!/bin/bash# Correct versionfor x in $; do?echo parameter: $xdone$ ./myscript arg 1 arg2 arg3parameter: arg 1parameter: arg2parameter: arg3 bash $* $ *? ? Expands to the positional parameters, starting from one.? ? ? When the expansion occurs within double quotes, it? ? ?expands to a single word with the value of each parameter? ? ?separated by the first character of the IFS special variable.? ? ? That is, $* is equivalent to $1c$2c.,? ? Expands to the positional parameters, starting from
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 办公效率提升解决方案指南
- 北京邮电大学出版社教学设计-2025-2026学年中职中职专业课工商管理类73 财经商贸大类
- 活动4 打扫校园教学设计小学劳动粤教版劳动与技术三年级-粤教版(劳动与技术)
- 2026届河南省南阳市高三下学期第二次质量检测政治试题(含答案)
- 劳动主题 巧手洗碗筷教学设计-2025-2026学年小学劳动二年级(2017)粤教版《劳动与技术》
- 停电紧急照明保障电力维护人员预案
- 汽车改装技术及安全标准手册
- 卓越创新服务承诺函(5篇)
- 任务三:举办演讲比赛(教学设计)八年级语文下册同步备课系列(统编版)
- 软件测试质量控制操作训练手册
- 咸阳亨通电力(集团)有限公司招聘笔试题库2026
- 残疾人保健知识培训课件
- 桂妇儿系统信息安全课件
- 天然气维修安全常识培训课件
- AI在医疗质量控制中的全流程管理
- 2026年南阳科技职业学院单招综合素质考试题库带答案详解
- 数字疗法在糖尿病管理中的创新应用
- 2026年二级建造师之二建机电工程实务考试题库500道及一套参考答案
- 膀胱内异物护理查房
- 二尖瓣钳夹术护理查房
- 物料供应商遴选制度
评论
0/150
提交评论