Reputation: 11
DESCRIPTION: Currently needing to input (or) pass the "realpath" of each file found hit found into a text file named "RESULTS.txt" that can be accessed by the user after the script runs.
ISSUE: Currently the syntax that i'm using to pass the code into the text file is failing. When I go to access the file it is blank. The following is the current code that is being used.
while read -r filename
do
filecount=$((filecount+1))
tput rc # return cursor to previously saved terminal line (tput sc)
# print filename (1st line of output); if shorter than previous filename we need to erase rest of line
filename="${filename%$'\r'}"
printf "file: ${filename}${erase}\n"
realpath "$filename" > RESULTS.txt
# print our status bar (2nd line of output) on the first and every ${modcount} pass through loop;
if [ ${filecount} -eq 1 ]
then
printf "[${barhash}${barspace}]\n"
elif [[ $((filecount % ${modcount} )) -eq 0 ]]
then
# for every ${modcount}th file we ...
barspace=${barspace:1:100000} # strip a space from barspace
barhash="${barhash}#" # add a '#' to barhash
printf "[${barhash}${barspace}]\n" # print our new status bar
fi
done < <(find "$dir_choice" -type f | sort -V )
...Pretty sure that the mistake that I am making is silly and is matter of syntax along with place ment not sure if I should be using realpath "$filname" >> RESULTS
instead realpath "$filename" > RESULTS.txt
Upvotes: 0
Views: 219