if语句chkifroot
确认root用户,然后查看a磁盘情况
#!/bin/bash
#function:演示
#author:tommy 20211013
if
[ "$USER" != "root" ]
then
echo "错误:非root用户,权限不足!"
exit 1
fi
fdisk -l /dev/sda
#function:演示
#author:tommy 20211013
if
[ "$USER" != "root" ]
then
echo "错误:非root用户,权限不足!"
exit 1
fi
fdisk -l /dev/sda
上一技术:if语句chkmountdir
下一技术:if语句pinghost