1 #!/bin/bash
2
3 #================================================================
4 # Copyright (C) 2021 . All rights reserved.
5 #
6 # 文件名称:showDisk.sh
7 # 创 建 者:gan
8 # 创建日期:2021年04月11日
9 # 描 述:
10 #
11 #================================================================
12
13 DISKFILE=`lsblk | grep -Eo "^[sh]d[a-z]"`
14 COUNT=`lsblk | grep -Eo "^[sh]d[a-z]" | wc -l`
15 echo $DISKFILE
16 echo $COUNT
17 if (( COUNT == 1 ));then
18 fdisk -l "/dev/$DISKFILE"
19 else
20 fdisk -l "/dev/$( echo $DISKFILE | xargs -n 1 | tail -n 1 )"
21 fi