Artificial intelligent assistant

Not correct renaming of files I have a script renaming a file due to the configuration. By what it s renaming file on $last - its adding a space, so the program not working correctly. What can be the problem? > Config file < Code #!/bin/bash while true do wget source TintedRawRubberyChafer.txt if [-e $curr]; then echo "Make changes" mv claymore.stub.conf $last mv $curr claymore.stub.conf fi rm TintedRawRubberyChafer.txt | echo "removed" sleep 60 done exit 0 The thing is, the output from console is 'claymore.stub.conf' -> 'zcash'$'\r'. But there must not be '\r'

Your '\r' comes from < which has two defects:

* its lines are CR-LF terminated (change this with `tr -d '\r'` or with `dos2unix`, `sed`, `vim`, etc)
* its last line is not LF-terminated



So bash presumes you mean `last=$'zcash\r'`.

Morevover:

* unless really necessary, you should quote your variables (`"$last"` not `$last`)
* `[-e $curr]` should be written `[ -e $curr ]`, or best `[ -e "$curr" ]` (spaces are important)
* your `| echo` does not need a pipe. Just put `echo` on a separate line.
* since you do not check for errors, your `wget`+`source`+`rm` could simply be written:

source <(wget -O- <

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 5f0836ecf99ab6e40188ae78c36f3973