Update storage-test.sh

This commit is contained in:
2025-05-04 10:27:27 -05:00
parent c9f609746c
commit 5653d242c0

View File

@@ -104,25 +104,27 @@ IO4kRandWrite=0
# Did the user give a folder ? # Did the user give a folder ?
ChosenPartition="" ChosenPartition=""
if [ "$1" = "" ]; then if [ "$1" = "" ]; then
drives="$(/bin/df -kTh | grep ext4)"
echo echo
Print_Style "Select a drive to test from:" "$YELLOW" Print_Style "Select a drive to test from:" "$YELLOW"
df=0; declare -A drive_sel df=0
echo "$(/bin/df -kTh | grep ext4)" | while IFS= read -r line ; do echo "$drives" | while IFS= read -r line ; do
((df++)) ((df++)); path=$(echo $line | cut -d'%' -f2)
path=$(echo $line | cut -d'%' -f2)
drive_sel[$df]=${path// }
Print_Style "$df) ${path// }" "$CYAN" Print_Style "$df) ${path// }" "$CYAN"
done done
echo echo
# read -r -p '#: ' drive_path </dev/tty # read -r -p '#: ' drive_path </dev/tty
echo echo
echo ${drive_sel[@]} df=0
echo "cd ${drive_sel[1]}" echo "$drives" | while IFS= read -r line ; do
echo "cd ${drive_sel[2]}" ((df++)); path=$(echo $line | cut -d'%' -f2)
echo "cd ${drive_sel[3]}" if [ $df -eq $drive_path ]; then
echo $path
break
fi
done
exit 0 exit 0
cd \
else else
if [ ! -d "$1" ]; then if [ ! -d "$1" ]; then
Print_Style "Your chosen partition (folder) does not exist! Provide a good one or run without parameters to check the rootfs" "$RED" Print_Style "Your chosen partition (folder) does not exist! Provide a good one or run without parameters to check the rootfs" "$RED"