




已阅读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:技术创新驱动下的碳减排量核算策略报告
- 2025年新能源汽车自动驾驶技术测试与保险产品创新服务报告
- 仓库卷帘门安装施工详细方案
- 城市绿化景观设计方案范文
- 环保产业园2025年循环经济模式下的废弃物处理与资源化利用产业市场竞争力提升路径报告
- 电梯安全培训简答题试题及答案解析
- 2025年微电网储能系统在新能源储能技术发展趋势中的应用报告
- 银行业从业资格考试宝典及答案解析
- 建筑施工合同管理操作手册
- 方大岗前培训安全考试题及答案解析
- 粘多糖贮积症专家讲座
- 煤矿群监员培训
- 教学课件 国际结算(第七版)苏宗祥
- 大学英语四级写作技巧及模板
- 成都燃气公司招聘笔试题
- 某铁路站房钢筋工程技术交底
- SMM英国建筑工程标准计量规则中文版全套
- 颈动脉保护装选择
- 水泥熟料生产工艺及设备课件
- 学前卫生学第二章课件
- 2023年东台市城市建设投资发展集团有限公司招聘笔试题库及答案解析
评论
0/150
提交评论