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

℡╲_俬逩灬. 提交于 2019-12-30 09:30:06

问题


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

回答1:


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


来源:https://stackoverflow.com/questions/22236197/how-to-remove-0d-from-end-of-url-when-using-wget

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!