I have a script that iterates through files and does some string substitution to insert the date. #!/bin/bash f="/tmp/file.txt" # with .txt extension timestamp="$(date +%H%M%S)" echo "${f%%.*}-$timestamp.${f#*.}" It provides the following output, which is correct. /tmp/file-220304.txt But if a ...