Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove %0D from end of URL when using wget?

Tags:

linux

wget

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
like image 449
user3388884 Avatar asked Mar 06 '14 21:03

user3388884


People also ask

How do I pass a header in wget?

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 ~/.

How does wget command work?

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.

How do I download a website using wget?

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.


1 Answers

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
like image 51
James McLaughlin Avatar answered Sep 20 '22 14:09

James McLaughlin