Hello and thanks in advance.
I'm trying to apply this script on my own environment.
The first part that gets all the list of files works well and are saved in a file text. But when trying to deleted, find, listing or anything that I've tried to do, always shows me the same error message in the bash. After hours of trying, It's gonna make me crazy.
ls: can't access to 's_FilterExecuteAction_log_SQLSERVER.txt'$'\r': File or directory doesn't exists
Always adds the characters $'\r' at the end of the variable when trying to do some with them. But if I list the file with the filename lists, it shows clean:
root@docker:~# head /tmp/mattermost-paths.list
SQ_MNGTOOL_DataFiltering.xlsx
WF _ DataFiltering.docx
s_FilterDeleteTemp_log_SQLSERVER.txt
s_FilterExecuteAction_log_SQLSERVER.txt
s_FilterExecuteScript_log_SQLSERVER.txt
I've tried to use some commands over the file, but I get nothing, like:
sed -i -r '/^\s*$/d;s|.*/||' $TMP_FILE
or
sed 's/\r$\|*\r//g;s/\r/\n/g' $TMP_FILE
It is so annoying and don't understand why listing file not showing that characters and trying to read and use as variables add this "crap" ($'\r') at the end of the line.
Hope someone can helps. Regards