Total count of the array values
问题 Here I'm accepting few mount points from the user and using each value to get space available on the host. ./user_input.ksh -string /m01,/m02,/m03 #!/bin/ksh STR=$2 function showMounts { echo "$STR" arr=($(tr ',' ' ' <<< "$STR")) printf "%s\n" "$(arr[@]}" for x in "${arr[@]}" do free_space=`df -h "$x" | grep -v "Avail" | awk '{print $4}'` echo "$x": free_space "$free_space" done #echo "$total_free_space" } Problems: How can I exit for loop if any of the user input mount not avaialble?