多個指令怎麼弄成一個批次檔(或makefile) - Linux

Table of Contents

我現在有五個指令
假設已經進入root模式


指令如下:
zypper ref (更新套件庫)

zypper up (更新檔案)

zypper rm -u cheese (自動移除不再被需要的相依性套件)

zypper lr -e /root/my.repo (匯出套件庫設定)

zypper ar /root/my.repo (匯入套件庫設定)


我想要一次執行這五個指令

請問要怎麼打包寫成一個批次檔(或者makefile檔)?

麻煩知道的解惑

謝謝

--

All Comments

Dora avatarDora2012-06-03
google一下shell script教學,簡單一句話就是把你的命令都
Skylar Davis avatarSkylar Davis2012-06-06
寫進一個文字檔,第一行用 #!/bin/sh 或 #!/bin/bash
然後 chmod +x 該文字檔案就可以執行了
Andy avatarAndy2012-06-11
chmod +x 該文字檔檔名
Hedda avatarHedda2012-06-15
若沒要重複使用 就把這些指令中間用;分隔 打在同一行
enter就送出即可