From 366ada5b8fb59769ababfd39a68e3b51d46cf2d8 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 7 Sep 2016 23:46:22 -0400 Subject: [PATCH] numerous minor changes to either use the sep function instead of old name of 'line', or to change usages of 'line' as a variable since it's a shell builtin and i generally like to avoid even the appearance of name conflicts. --- customizing/fred/scripts/update_soapbox.sh | 19 ++++++------------- scripts/archival/search_arch.sh | 6 +++--- scripts/buildor/buildor_count_code.sh | 6 +++--- scripts/clam/cpp/rebuild_oldies.sh | 2 +- scripts/email/count_maildir.sh | 2 +- scripts/files/checker_report.sh | 4 ++-- scripts/files/remove_here_if_not_there.sh | 6 +++--- scripts/multimedia/maybe_zap_pic.sh | 4 ++-- scripts/multimedia/play_random.sh | 2 +- scripts/processes/show_hot_ones.sh | 7 ++----- scripts/rev_control/version_control.sh | 6 +++--- scripts/text/csv_to_array.sh | 6 +++--- scripts/text/parse_csv_line.h | 1 + 13 files changed, 31 insertions(+), 40 deletions(-) diff --git a/customizing/fred/scripts/update_soapbox.sh b/customizing/fred/scripts/update_soapbox.sh index a20ea5fa..be3a1e10 100644 --- a/customizing/fred/scripts/update_soapbox.sh +++ b/customizing/fred/scripts/update_soapbox.sh @@ -2,13 +2,6 @@ # updates my little 1 TB "soapbox" style usb drive with items that it should contain. -function liney() -{ - echo - echo ============== - echo -} - function get_source() { folder="$1"; shift @@ -26,7 +19,7 @@ function get_source() popd } -liney +sep ls /media/fred/soapboxdrive if [ $? -ne 0 ]; then @@ -34,7 +27,7 @@ if [ $? -ne 0 ]; then exit 1 fi -liney +sep echo synching walrus... rsync -av /z/walrus/* /media/fred/soapboxdrive/walrus/ @@ -43,7 +36,7 @@ if [ $? -ne 0 ]; then exit 1 fi -liney +sep echo synching musix... rsync -av /z/musix/* /media/fred/soapboxdrive/musix/ @@ -52,19 +45,19 @@ if [ $? -ne 0 ]; then exit 1 fi -liney +sep echo getting latest fred codes... pushd /media/fred/soapboxdrive get_source extra_brain -liney +sep echo getting latest gffs codes... get_source gffs popd -liney +sep echo Updated all portions of the soapbox drive successfully. diff --git a/scripts/archival/search_arch.sh b/scripts/archival/search_arch.sh index 68ec6856..934d50d0 100644 --- a/scripts/archival/search_arch.sh +++ b/scripts/archival/search_arch.sh @@ -31,9 +31,9 @@ find "$dir" -iname "*.jar" -o -iname "*.zip" -o -iname "*.tar" \ -o -iname "*.iar" -o -iname "*.oar" -o -iname "*.bz2" -o -iname "*.snarf" \ >"$TMPFILE" -while read line; do - bash $FEISTY_MEOW_SCRIPTS/archival/list_arch.sh "$line" 2>&1 | grep -i "$pattern" >/dev/null - if [ $? -eq 0 ]; then echo ==== Found pattern in $line ====; fi +while read input_text; do + bash $FEISTY_MEOW_SCRIPTS/archival/list_arch.sh "$input_text" 2>&1 | grep -i "$pattern" >/dev/null + if [ $? -eq 0 ]; then echo ==== Found pattern in $input_text ====; fi done <"$TMPFILE" \rm -f "$TMPFILE" diff --git a/scripts/buildor/buildor_count_code.sh b/scripts/buildor/buildor_count_code.sh index c80b6f81..0be0a0ea 100644 --- a/scripts/buildor/buildor_count_code.sh +++ b/scripts/buildor/buildor_count_code.sh @@ -31,9 +31,9 @@ while true; do #cat $NAME_LIST_TEMP_FILE #echo ==================================================== - while read line; do -#echo line is $line - count=$(grep -h -v -c "^[ ]*$" $line) + while read input_text; do +#echo input_text is $input_text + count=$(grep -h -v -c "^[ ]*$" $input_text) TOTALS=$(($TOTALS + $count)) #echo total is $TOTALS now done < "$NAME_LIST_TEMP_FILE" diff --git a/scripts/clam/cpp/rebuild_oldies.sh b/scripts/clam/cpp/rebuild_oldies.sh index 92e83a74..02d33535 100755 --- a/scripts/clam/cpp/rebuild_oldies.sh +++ b/scripts/clam/cpp/rebuild_oldies.sh @@ -1,6 +1,6 @@ #!/bin/bash if [ -f "$BUILD_LIST_FILE" ]; then - echo Compiling [$(cat $BUILD_LIST_FILE | while read line; do echo $(basename $line); done )] + echo Compiling [$(cat $BUILD_LIST_FILE | while read input_text; do echo $(basename $input_text); done )] rm -f $(cat $BUILD_WHACK_FILE) #echo got line to run: $* eval "${@}" diff --git a/scripts/email/count_maildir.sh b/scripts/email/count_maildir.sh index d9273831..3636bd99 100644 --- a/scripts/email/count_maildir.sh +++ b/scripts/email/count_maildir.sh @@ -9,7 +9,7 @@ folderlist=$TMP/zz_folder_list.txt find . -name "cur" >$folderlist -while read line; do echo -n "$line -- " ; find "$line" -type f | wc -l ; done < $folderlist +while read input_text; do echo -n "$input_text -- " ; find "$input_text" -type f | wc -l ; done < $folderlist popd &>/dev/null diff --git a/scripts/files/checker_report.sh b/scripts/files/checker_report.sh index 759b8d38..3dd649ab 100644 --- a/scripts/files/checker_report.sh +++ b/scripts/files/checker_report.sh @@ -27,8 +27,8 @@ temp_file_list="$(mktemp /tmp/file_list_temporary.XXXXXX)" find "$dirname" -type f >"$temp_file_list" ###-exec echo \"{}\" ';' -while read line; do - checker -q -b "$line" 2>&1 >>"$outfile" +while read input_text; do + checker -q -b "$input_text" 2>&1 >>"$outfile" done <"$temp_file_list" diff --git a/scripts/files/remove_here_if_not_there.sh b/scripts/files/remove_here_if_not_there.sh index 8e78600e..6ba6a4e3 100644 --- a/scripts/files/remove_here_if_not_there.sh +++ b/scripts/files/remove_here_if_not_there.sh @@ -44,9 +44,9 @@ whack_list="$(mktemp "$TMP/remover_list.XXXXXX")" comm -23 "$here_temp_file" "$there_temp_file" >"$whack_list" -while read line; do - if [ -z "$line" ]; then break; fi - herename="$here/$line" +while read input_text; do + if [ -z "$input_text" ]; then break; fi + herename="$here/$input_text" rm -v "$herename" done <"$whack_list" diff --git a/scripts/multimedia/maybe_zap_pic.sh b/scripts/multimedia/maybe_zap_pic.sh index 7fa7133b..9b2c667b 100644 --- a/scripts/multimedia/maybe_zap_pic.sh +++ b/scripts/multimedia/maybe_zap_pic.sh @@ -14,9 +14,9 @@ for i in "$@"; do eog "$file" # now ask the big question: to whack or not to whack? echo "whack this file? (y/N)" - read line + read inputtext # a few things mean yes here. - if [ "$line" == "y" -o "$line" == "Y" -o "$line" == "yes" ]; then + if [ "$inputtext" == "y" -o "$inputtext" == "Y" -o "$inputtext" == "yes" ]; then echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "$(date): deleting $file." perl $FEISTY_MEOW_SCRIPTS/files/safedel.pl "$file" diff --git a/scripts/multimedia/play_random.sh b/scripts/multimedia/play_random.sh index 7ea0a6cf..a5df0093 100644 --- a/scripts/multimedia/play_random.sh +++ b/scripts/multimedia/play_random.sh @@ -15,7 +15,7 @@ if [ ! -z "$grunty" ]; then FILE_LIST=$(find $VOXDIR -type f) echo "file list is $FILE_LIST" LINES=$(find $VOXDIR -type f | wc -l) -#echo "lines is $LINES" +#echo "info found is: $LINES" LESS_CHANCE=$(expr $LINES \\* 4) #echo "less chance is $LESS_CHANCE" TO_PLAY= diff --git a/scripts/processes/show_hot_ones.sh b/scripts/processes/show_hot_ones.sh index 2e1fac6c..cd948b8d 100644 --- a/scripts/processes/show_hot_ones.sh +++ b/scripts/processes/show_hot_ones.sh @@ -2,10 +2,7 @@ # shows the current processes ordered by cpu usage. -# generate a nice separator. -for ((i=0; i<14; i++)); do line+='='; done - -echo $line +sep echo "Process list by CPU usage for $(date)" ps wuax --sort -%cpu | head -n 8 -echo $line +sep diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 068bd66d..b6ab0217 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -193,12 +193,12 @@ function checkin_list() function squash_first_few_crs() { i=0 - while read line; do + while read input_text; do i=$((i+1)) if [ $i -le 5 ]; then - echo -n "$line " + echo -n "$input_text " else - echo $line + echo $input_text fi done if [ $i -le 3 ]; then diff --git a/scripts/text/csv_to_array.sh b/scripts/text/csv_to_array.sh index 7c114c48..021891d0 100644 --- a/scripts/text/csv_to_array.sh +++ b/scripts/text/csv_to_array.sh @@ -40,10 +40,10 @@ function parse_csv_line() for i in $*; do echo reading $i - while read line; do -# echo line is $line + while read input_text; do +# echo input_text is $input_text csv_split=() - parse_csv_line "$line" + parse_csv_line "$input_text" if [ ${#csv_split[*]} -lt 1 ]; then echo did not see any fields in the split array. diff --git a/scripts/text/parse_csv_line.h b/scripts/text/parse_csv_line.h index 53b36d0f..5f86d0d5 100644 --- a/scripts/text/parse_csv_line.h +++ b/scripts/text/parse_csv_line.h @@ -1,3 +1,4 @@ +#!/bin/bash ############################################################################ # This function parses a line from a CSV file (you pass the line as the # argument) into elements in an array. The CSV elements must be enclosed -- 2.34.1