find - Output is stopped because of & (ampersand). I need to enclose each line of output in quotes? I think? - Ask Ubuntu
i use pushbullet send list of modified files phone each morning. use find , printf clean list , push pushbulet script.
/home/user/scripts/pushbullet/pushbullet.sh "synced: `find /mnt/1tb/tv/ /mnt/1tb/movies/ -type f -ctime -1 | wc -l`" "`find /mnt/1tb/tv/ /mnt/1tb/movies/ -type f -ctime -1 -printf "%f\n"`"
first gets count of modified files, , list of modified files without directory.
the problem if file name file&cheese.mkv
message sent me stops @ 'file' , nothing after ampersand sent. problem pushbullet script.
i think easiest make sure each line of list output goes in quotation marks cannot work out how this.
any ideas?
you can each filename in quotes piping find
output while
, using echo
find ... | while read line ; echo \""$line"\" ; done
replace find ...
whole find
command.
the escaped quotes \"
print literal "
around each line, quote variable prevent expansions.
output like
"my file" "another file" "file&cheese.mkv"
Comments
Post a Comment