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