欢迎来到电脑知识学习网,专业的电脑知识大全学习平台!

手机版

linux命令读取u盘-(linux命令行读取u盘)

操作系统 发布时间:2022-12-24 04:54:57
linux命令读取u盘 (linux命令行读取u盘)

# 加载U盘函数

mountusb( )

{ clear

mkdir /mnt/usb # 在/mnt下创建usb目录

/sbin/fdisk –l |grep /dev/sd #查看U盘设备名称

echo “Please Enter the device name”

read PARAMETER

mount /dev/$PARAMETER /mnt/usb

}

# 显示U盘信息函数

display()

{ clear

ls -la /mnt/usb

}

# 卸载U盘函数

umountusb( )

{ clear

umount /mnt/usb

}

# 拷贝硬盘文件到U盘函数

电脑

cpdisktousb()

{

clear

echo “Please Enter the filename (under Current directory)”

read FILE

echo “Copying,please wait!...”

cp $FILE /mnt/usb

}

# 拷贝U盘函数到硬盘文件

cpusbtodisk()

{

clear

echo“Please Enter the filename to be Copide in USB”

read FILE

echo “Copying ,Please wait!...”

cp /mnt/usb/$FILE . #点(.)表示当前路径

}

退出函数

quit()

{ clear

echo “***thank you to use,Good bye! ****”

exit 0

}

# 主程序

clear

while true

do

echo “***LINUX USB MANAGE PROGRAM***”

echo “1-MOUNT USB ”

echo “2-UNMOUNT USB ”

echo “3-DISPLAY USB INFORMATION”

echo “4-COPY FILE IN DISK TO USB ”

echo “5-COPY FILE IN USB TO DISK”

echo “0-EXIT ”

echo “Please Enter 电脑 a Choice(0-5)”

read CHOICE

case $CHOICE in

1) mountusb ;;

2) unmountusb ;;

3) display ;;

4) cpdisktousb ;;

5) cpusbtodisk ;;

0) quit ;;

*) echo “Invalid Choice!Corrent Choice is (0-5)”

sleep 4

clear;;

esac

done


电脑
责任编辑:电脑知识学习网

操作系统