How to remove %0D from end of URL when using wget?
I have a sh script with the following wget. However, when executed on the linux box, wget is attemping the second URL below (%OD attached). How do i prevent this from happening? I have multiple scripts, they're all having the same issue. Thanks!
wget https://example.com/info.repo
wget https://example.com/info.repo%0D
wget allows you to send an HTTP request with custom HTTP headers. To supply custom HTTP headers, use "--header" option. You can use "--header" option as many time as you want in a single run. If you would like to permanently set the default HTTP request header you want to use with wget, you can use ~/.
Wget is the non-interactive network downloader which is used to download files from the server even when the user has not logged on to the system and it can work in the background without hindering the current process.
Let's start with something simple. Copy the URL for a file you'd like to download in your browser. Now head back to the Terminal and type wget followed by the pasted URL. The file will download, and you'll see progress in realtime as it does.
The OD
character is a carriage return, part of the CRLF sequence that Windows uses for line endings just to be different as usual.
You can use dos2unix to fix the line endings before executing, and in future don't use Notepad to write shell scripts.
dos2unix myscript.sh
./myscript.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With