From 54fcb2c0f111f618c7ea64f6affc58e143b4ec36 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 1 Jun 2023 11:19:26 -0600 Subject: [PATCH] Another attempt to check min rows and columns --- ishare2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ishare2 b/ishare2 index 85c276b..79c271d 100755 --- a/ishare2 +++ b/ishare2 @@ -436,9 +436,10 @@ check_file_corruption() { fi # Check the minimum number of columns and rows - num_columns=$(awk -F',' 'NR==1{print NF}' "$DIR/$FILENAME") + num_columns=$(head -n 1 "$DIR/$FILENAME" | awk -F',' '{print NF}') num_rows=$(wc -l <"$DIR/$FILENAME") - if [ "$num_columns" -lt 4 ] || [ "$num_rows" -lt 5 ]; then + + if ((num_columns < 4 || num_rows < 5)); then echo -e "${RED} [!] The file $FILENAME is corrupted. ${NO_COLOR}" read -p "Do you want to download the file again? (y/n): " choice case $choice in