I have printf statements that are not displaying correctly in a Terminal window. The first two display correctly but the third printf "Writing to %s$output%s" "$biwhite" "$color_off" is not showing up except for the last few characters of $output
It feels like a bug of some sort. If I substitute echo for printf the line displays correctly, minus the coloring. I've tried putting all the statements in one printf with the same results. It is as though printf reallllly hates that one sentence. I'm at a loss as to what could be causing it. I'm working in OSX.
biwhite=$(tput bold)$(tput setaf 7) #bired=$(tput bold)$(tput setaf 1) color_off=$(tput sgr0) date="$(date +%Y%m%d)" while [[ $# -gt 0 ]] ; do input="$1" #name $input as the first arugment sent to script if [ -d "$input" ] ; then #if argment is a directory, run md5deep target="${input%/}" #strip the trailing /, if any target="${target##*/}" #drop the leading directory componenets i.e. get basename output="$input"/"$target"_"$date"_checksums.md5 #set .md5 file to $output printf "%s${input##*/}%s is a directory.\n" "$biwhite" "$color_off" printf "Making checksums of all files in %s$input%s\n" "$biwhite" "$color_off" printf "Writing to %s$output%s" "$biwhite" "$color_off" md5deep -bre "$input" >> "$output" #create md5 hash (hashes) of $input and write results to $output fi shift done