blkid命令,列出存储设备和存储设备信息
root@OpenWrt:/# blkid
/dev/mmcblk0p1: TYPE="squashfs"
/dev/mmcblk0p2: LABEL="nasetc" UUID="f4c72ecc-3e10-d251-8d3e-65c472a903a5" TYPE="ext4"
/dev/sda1: UUID="A4C3-44C5" TYPE="vfat" PARTUUID="007f83fb-01"
/dev/mmcblk1p1: UUID="1033-3C38" TYPE="vfat"
/dev/mmcblk0: PTTYPE="dos"
/dev/mmcblk1: PTTYPE="dos"
root@OpenWrt:/#
用shell脚本获取uuid;
blkid /dev/mmcblk1p1 |awk -F ' ' '{print $2}' |cut -d= -f2 | sed 's/\"//g'
执行后,获取mmcblk1p1的uuid