1 shell scripts 入門

1 shell scripts 入門

 linux之shell scripts (類似dos之批次檔)

例:製做類似dos之diskcopy外部指令

檔案名稱:diskcopy

#!/bin/sh
echo -n “Insert source disk in first floppy drive,then hit enter”
read ans;
dd if=/dev/fd0 of=/tmp/dcopy$$
echo -n “Remove source disk and insert other disk ,then hit enter”
read ans;
dd of=/dev/fd0 if=/tmp/dcopy$$
/bin/rm -f /tmp/dcopy$$

備註:不用副檔名;需更改檔案屬性為可執行;例 chmod 755 diskcopy

 

Linux
CH1 簡介CH10 自動啟動CH2 檔案指令CH20 Q&ACH3 系统指令CH4 用戶管理CH5 網路CH6 shell scriptsCH8 安裝軟體CH9 硬體驅動程式