收藏 分享(赏)

第 7 章 Shell Script 程式设计.ppt

上传人:jinchen 文档编号:8698987 上传时间:2019-07-08 格式:PPT 页数:15 大小:91.50KB
下载 相关 举报
第 7 章 Shell Script 程式设计.ppt_第1页
第1页 / 共15页
第 7 章 Shell Script 程式设计.ppt_第2页
第2页 / 共15页
第 7 章 Shell Script 程式设计.ppt_第3页
第3页 / 共15页
第 7 章 Shell Script 程式设计.ppt_第4页
第4页 / 共15页
第 7 章 Shell Script 程式设计.ppt_第5页
第5页 / 共15页
点击查看更多>>
资源描述

1、1,第 7 章 Shell Script 程式設計,內容 Shell 命令稿簡介 基本敘述句 選擇性程式結構 重複性程式結構 函數,2,7-1 Shell Script 程式簡介 (1),何謂 Shell script 批次檔案 連續執行多個命令 Shell script (命令稿) 多個外殼命令 + 變數 + 程式控制結構 外殼命令 ls, cp, cat, finger, . 程式控制結構 if, while, case, for, select, 變數 環境變數, 自訂變數, 位置變數,3,7-1 Shell Script 程式簡介 (2),Shell script 執行 步驟 1:設定

2、命令搜尋路徑 $ export PATH=$PATH:. 步驟 2:利用 vi 編輯程式 $ vi shell.scr 步驟 3:設定成可執行檔 $ chmod u+x shell.scr 步驟 4:執行 shell script 程式 $ shell.scr,4,7-1 Shell Script 程式簡介 (3),Shell script 變數 自訂變數 (variable 程式範例) int=5 echo “intger = $int” 位置變數 (args 程式範例) $1, ,5,7-2 基本敘述句,輸出敘述 echo echo “Good lucky to you” 輸入敘述 rea

3、d echo n “What is your name =” read name 設定位置變數 set date 數學運算expr 3 + 4,6,7-3 選擇性結構敘述 (1),條件敘述 (1) 數值比較 test integer1 eq integer2 integer1 eq integer2,7,7-3 選擇性結構敘述 (2),條件敘述 (2) 字串比較,8,7-3 選擇性結構敘述 (3),條件敘述 (3) 檔案屬性測試 Test d file_1 -d file_1,9,7-3 選擇性結構敘述 (4),if 程式結構 標準格式簡單格式最簡潔格式,if 條件判斷 then命令敘述區段

4、fi,if 條件判斷; then命令敘述區段 fi,if 條件判斷; then; 命令敘述區段; fi,10,7-3 選擇性結構敘述 (5),case 程式結構,case variable in pattern_1) 命令敘述區塊 ; pattern_2)statement 1;statement 2;statement 3; pattern_3) 命令敘述區塊 ; esac,11,7-4 重複性結構敘述 (1),for 迴圈結構,for var in List docommandscommands done,12,7-4 重複性結構敘述 (2),select 迴圈結構,select var in List docommandscommands. done,13,7-4 重複性結構敘述 (3),while 迴圈結構,while 條件判斷 do命令區塊 done,14,7-4 重複性結構敘述 (4),until 迴圈結構,until 條件判斷 do命令區塊 done,15,7-5 函數,函數結構,Function function_name 命令或程式區塊 或 function_name() 命令或程式區塊 ,

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报