预览加载中,请您耐心等待几秒...
1/7
2/7
3/7
4/7
5/7
6/7
7/7
在线预览结束,喜欢就下载吧,查找使用更方便
如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
01.sh#!/bin/bash#program#thisprogramshows"Helloeveryone!welcometotheworldofshellscript"inyourscreen#History:#2013/03/25ccfirstreleaseecho"Helloeveryone!"echo"welcometotheworldoftheshellscript!"02.sh#!/bin/bash#program#thisprogramshows"Helloeveryone!welcometotheworldofshellscript"inyourscreen#History:#2013/03/25ccfirstreleaseread-p"pleaseenteryourname:"nameecho"Hello$name,"echo"welcometotheworldofshellscript!"03.sh#!/bin/bash#program:#letuserinputafilename,theprogramwillsearchthefilename#1)exist?2)fileordirectory?3)filepermissions#让用户输入文件名,并且判断用户是否真的有输入字符串echo-e"theprogramwillshowyouthatthefilename'stypeandpermissionwhichyouinput."read-p"inputafilename:"filenametest-z$filename&&echo"youmustinputafilename!"&&exit0#判断文件是否存在,如果不存在则结束脚本test!-e$filename&&echo"thefilewhosenamed$filenameisnotexit"&&exit0#判断是否是普通文件,如果不是则结束脚本test!-f$filename&&echo"thefilenameisnotaregularfile"&&exit0#文件存在且为普通文件,则开始判断文件的属性perm=""test-r$filename&&perm="$perm""&""readable"test-w$filename&&perm="$perm""&""writable"test-x$filename&&perm="$perm""&""executable"#输出判断信息echo"theregular&filename'spermissionis:$perm."04.sh#!/bin/bash#program:#thisprogramshowuser'schoiceecho"ifyouwanttocontinue,pleaseinputY"echo"ifyouwanttointerruput,PleaseinputN"read-p"pleaseinputyourchoice:"choice["$choice"=="Y"-o"$choice"=="y"]&&echo"ok,continue!"&&exit0["$choice"=="N"-o"$choice"=="n"]&&echo"ok,interrupt!"&&exit0echo"idon'tknowwhatyourchoiceis"&&exit005.sh#!/bin/bash#program#thisprogramwilltellyouthedefaultvariablesusedinscriptecho"thescriptnameis$0"echo"thefirstparameteris$1"echo"thesecondparameteris$2"echo"thethirdparameteris$3"echo"totalparameternumberis$#"echo"thewholeparameteris"$@""06.sh#!/bin/bash#program#thisprogramshowuser'schoiceecho"ifyouwanttocontinue,pleaseinputY"echo"ifyouwanttointerruput,PleaseinputN"read-p"pleaseinputyourchoice:"choiceif["$choice"=="Y"-o"$choice"=="y"];thenecho"ok,continue!"exit0fiif["$choice"==