more find more joy
Let's get down to the brass tacks.
Why isn't this working? Why are the \ \ disappearing in file: \ \&.txt?
code
#!/bin/bash
echo "in bash script $0"
ls -l '/Users/mac/exifinner/'
fileCount=$(ls -l '/Users/mac/exifinner/' | wc -l)
let fileCount--
echo "${fileCount} files found."
count=1
echo "starting finding files"
echo "read loop"
echo " so my first file is \"\\ \\&.txt\", but where are the two backslashes?"
find '/Users/mac/exifinner/' -type f -iname "*.txt" | (
while read theFilePath
do
echo -n " ${count}: "
echo "processing file " ${theFilePath}
echo " file ${theFilePath}"
echo ${theFilePath} | hexdump -C
let count++
done
)
echo "leaving $0"
exit 0
results
mac $ ./groupFind#JiustRead.sh
in bash script ./groupFind#JiustRead.sh
total 0
-rw-r--r-- 1 mac staff 0 Mar 1 19:13 \ \&.txt
-rw-r--r-- 1 mac staff 0 Mar 1 19:12 normal.txt
2 files found.
starting finding files
read loop
so my first file is "\ \&.txt", but where are the two backslashes?
1: processing file /Users/mac/exifinner// &.txt
file /Users/mac/exifinner// &.txt
00000000 2f 55 73 65 72 73 2f 6d 61 63 2f 65 78 69 66 69 |/Users/mac/exifi|
00000010 6e 6e 65 72 2f 2f 20 26 2e 74 78 74 0a |nner// &.txt.|
0000001d
2: processing file /Users/mac/exifinner//normal.txt
file /Users/mac/exifinner//normal.txt
00000000 2f 55 73 65 72 73 2f 6d 61 63 2f 65 78 69 66 69 |/Users/mac/exifi|
00000010 6e 6e 65 72 2f 2f 6e 6f 72 6d 61 6c 2e 74 78 74 |nner//normal.txt|
00000020 0a |.|
00000021
leaving ./groupFind#JiustRead.sh
mac $
Mac mini, OS X Yosemite (10.10.5), Fall 2014; iPhone 4 7.1.2