susuu 发表于 2006-5-25 23:49:16

我的处女shell脚本,发贴庆贺

我的处女shell脚本,发贴庆贺,虽然简单,但还是有点成就感.高手不要扁.

#!/bin/sh
echo "Select the device to ..."
select var in "xuexi" "movie" "mp3" "download" "cdrom" "Usb";do
break
done

case "$var" in
"xuexi"*)
mount /dev/hdc1 /mnt/xuexi;;
"movie"*)
mount /dev/hdc2 /mnt/movie;;
"mp3"*)
mount -t vfat /dev/hda6 /mnt/mp3 -o iocharset=cp936;;
"download"*)
mount -t ntfs /dev/hdc1 /mnt/downlad -o iocharset=cp936;;
"cdrom"*)
mount -t iso9660 -o loop /dev/cdrom /mnt/cdrom;;
"Usb"*)
mount /dev/sda1 /mnt/usb;;
esac

kakuyou 发表于 2006-5-26 00:19:02

:mrgreen:

yangh 发表于 2006-5-26 00:30:00

不错不错, 贴代码要用 code 标签,不然不工整


#!/bin/sh

echo "Select the device to ..."
select var in "xuexi" "movie" "mp3" "download" "cdrom" "Usb";do
      break
done

case "$var" in
      "xuexi"*)
                mount /dev/hdc1 /mnt/xuexi
                ;;
      "movie"*)
                mount /dev/hdc2 /mnt/movie
                ;;
      "mp3"*)
                mount -t vfat /dev/hda6 /mnt/mp3 -o iocharset=cp936
                ;;
      "download"*)
                mount -t ntfs /dev/hdc1 /mnt/downlad -o iocharset=cp936
                ;;
      "cdrom"*)
                mount -t iso9660 -o loop /dev/cdrom /mnt/cdrom
                ;;
      "Usb"*)
                mount /dev/sda1 /mnt/usb
                ;;
esac

exit 0


我第一次见识 select 命令。 :oops:

hohoxu_hao115 发表于 2006-5-26 00:34:34

嘿,同楼上一样。不过ntfs分区,用nls=cp936要好。iocharset已有些过时了。

duotaiya 发表于 2006-5-26 08:53:18

我知道你的处女shell是print xxx

biff 发表于 2006-5-26 09:22:51

我知道你的处女shell是print xxx
打屁屁,我猜是 echo 1:lol:
页: [1]
查看完整版本: 我的处女shell脚本,发贴庆贺