diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/test_generate_delete.sh | 2 | ||||
-rwxr-xr-x | test/test_replace_timestamp.sh | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/test/test_generate_delete.sh b/test/test_generate_delete.sh index 6764682..810eb96 100755 --- a/test/test_generate_delete.sh +++ b/test/test_generate_delete.sh @@ -1,6 +1,6 @@ #!/bin/bash -for i in {1..10} +for i in {1..5} do ./gentestfiles.sh ./test_deletefiles.sh diff --git a/test/test_replace_timestamp.sh b/test/test_replace_timestamp.sh index ffad66e..a8f44b9 100755 --- a/test/test_replace_timestamp.sh +++ b/test/test_replace_timestamp.sh @@ -3,7 +3,7 @@ LOG_DIR="/home/oskar/.trashsys/log" if [ -z "$1" ]; then - echo "Usage: $0 <replacement_string>" + echo "Usage: $0 <replacement_timestamp>" exit 1 fi @@ -16,8 +16,12 @@ fi for file in "$LOG_DIR"/*; do if [ -f "$file" ]; then - echo "replacing trashed time in: $file" - awk -v replacement="$REPLACEMENT" 'NR % 5 == 0 {print replacement} NR % 5 != 0 {print $0}' "$file" > "$file.tmp" && mv "$file.tmp" "$file" + echo "Replacing timestamp in: $file" + awk -v replacement="$REPLACEMENT" '{ + # Replace the fifth field (timestamp) with the replacement string + $5 = replacement + print $0 + }' "$file" > "$file.tmp" && mv "$file.tmp" "$file" fi done |