您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 咨询培训 > 在Linux世界驰骋系列之Shell编程
LinuxLinuxShellLinuxShellShellShellShellShellUnix/LinuxShellLinuxLinuxLinux://://://:2006-11-2020:58:57--LinuxShellShellShellShellShellUnix/LinuxLinuxShellShellShellifcasewhileforShellLinuxLinux:2006-11-2020:59:26ShellUnixUnixShellLinuxUnixShellbash:2006-11-2020:59:47Shell12*?[]3Shell,ShellcdechoexitpwdkillShell4Shell/I/O56Shell7Shell8ShellShellShellShellUnix:2006-11-2021:00:09LinuxShellBourneShellshC-ShelllcshKornShellkshBourneAgainShell(bash)(1)BourneShellAT&TBellStevenBourneAT&TUnixUnixShellShellBourneShellShell(2)CShellBillJoyBSDUnixshCBourneShellCShellBourneShell(3)KornShellAT&TBellDavidKornCShellBourneShellBourneShellKornShell(4)BourneAgainShell(bash)(GNU)ShellLinuxShellBashBourneShellCShellKornShell:2006-11-2021:00:34ShellShellShell(Shellscrpt)ShellLinuxShellviex1Shell$viex1viShell:2006-11-2021:01:14Shell(1)ShellShell$bash$bashex1Shellex1ShellShell(2)$bash$bashex2/usr/meng/usr/zhangShellShellShell$ShellShell(3)ShellviShellShellchmod$chmoda+xex2Shellex2,ex2(PATH)://:2006-11-2021:01:51ShellShellCShellShellShell:2006-11-2021:02:15ShelldirDirC=myfile=/usr/meng/ff/m1.c$$dir=/usr/meng/ff$echo$dir/usr/meng/ff$echodirdirnames=ZhangsanLisiWangwu``dir$dir=`pwd`$()$dir=$(pwd):2006-11-2021:02:34bashC00[]$city[0]=Beijing$city[1]=Shanghai$city[2]=Tianjin$declaredeclare-a${[]}$echo${city[0]}Beijing=(12...n)$A=(thisisanexampleofshellscrpt)$echo${A[0]}${A[2]}${A[3]}${A[6]}thisanexamplescrpt$echo${A[8]}$7A7A[8]A0citycity[0]*@[*][@]:2006-11-2021:02:57bash$name${name#pattern}${name}${name##pattern}${name[n]}${name%pattern}${name[*]}${name%%pattern}${name[@]}${#@}${name:-word}${$#*}${name:=word}${#name}${name:?word}${#name[*]}${name:+word}${#name[@]}1$namename2${name}namename3${name[n]}namen4${name[*]}${name[@]}name${name[*]},()${name[@]}name${name[@]}5${name:-word}${name:=word}${name:+word}${name:?word}6${name#pattern}${name##pattern}pattern()namename;,namenamepatternnamepattern7${name%pattern}${name%%pattern}patternnamenamename8${#@}${#*}$@$*9${#name[i]}namei()10${#nane[*]}${#name[@]}name:2006-11-2021:03:16readreadread1[2]readabc:2006-11-2021:03:53Unix/LinuxShellShellShellShell012012{10}{11}$set`pwd;ls;date`$echo$1$2$3$9${10}${11}/home/mengqcbash_1ex112321:52:329$1$99shiftshiftshift$1$2$2$3shift$0shift$0:2006-11-2021:04:12ShellShellShell$#Shell$Shell00$$$1~5$-ShellsetxvShell-x-v$*9$@$*$@$*:2006-11-2021:04:33LinuxShellShell$HOMELOGNAMELinuxMAILPATHPATHPS1Shellbash\s-\v\$\sShell\vbashPS1PS1=EnterCommandEnterCommandPWDLinuxSHELLShellShellTERMunset(NAME)$unsetNAMEexportexportHOMEHZLOGNAMETERMenv:2006-11-2021:04:532=${1op}op::=:+:?21:2006-11-2021:05:14bash(~/.bash_history)~(historysubstitution)historyhistory[option][arg?](1)historyhistory12historyhistory50503historyhistoryalal1\(()bash.bash_historyHISTFILE$HISTFILE=/home/mengqc/.myhistory500HISTSIZE=600HISTSIZE:2006-11-2021:05:32Shellaliasalias[name[=value]]()name=valuename()value$aliasll='ls-l'llls-lllShell()(ll)Shellunaliasnamenameunaliasunaliasunalias-a:2006-11-2021:05:57Shell*|:2006-11-2021:06:37*0f*f(.)(/)f?f1fafbffabcf12-f[a-d]f[abcd]!f[!19].cf19.cfa.cfb.cfm.c*:2006-11-2021:07:00bash1*()0|file*(.c.o)filefile.cfile.ofile.c.cfile.0.0file.c.ofile.o.cfil
本文标题:在Linux世界驰骋系列之Shell编程
链接地址:https://www.777doc.com/doc-4471588 .html