From 123d2fe2ff2549024500d3f19c999fd7b146dbd6 Mon Sep 17 00:00:00 2001 From: Nils <32552517+byReqz@users.noreply.github.com> Date: Fri, 22 Jan 2021 22:02:23 +0000 Subject: [PATCH] add help --- stocheck.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/stocheck.sh b/stocheck.sh index 6364a68..eebebdb 100644 --- a/stocheck.sh +++ b/stocheck.sh @@ -11,19 +11,22 @@ while [ ! -n "$1" ]; do if [[ -n $(ls /sys/block | grep sd) ]];then echo "=== sata drive check: ===" for x in {a..z};do - if [[ -n $(smartctl --scan | grep /dev/sd$x) ]];then + scan=$(smartctl --scan) + if [[ -n $(echo $scan | grep /dev/sd$x) ]];then echo "------------------- /dev/sd$x --------------------"; smartctl -H -i /dev/sd$x; - echo "-----------------------------------------------------"; + echo "-------------------------------------------------"; fi done if [[ -n $(ls /dev | grep nvme) ]];then echo "=== nvme drive check: ===" for x in {0..4};do + scan=$(smartctl --scan) + if [[ -n $(echo $scan | grep /dev/nvme$x) ]];then echo "------------------- /dev/nvme$x --------------------"; smartctl -H -i /dev/nvme$x; - echo "---------------------------------------------------------"; - exit + echo "---------------------------------------------------"; + fi done else exit @@ -44,5 +47,11 @@ while [ ! -z "$1" ]; do echo "#############################################" exit fi + elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]];then + echo "Usage: $0 (options) (y/n)" + echo "Options:" + echo " -u/--update -- update the script" + echo " -h/--help -- show help" + exit fi done