0

I need wget to be always used with --no-check-certificate option. This can be accomplished by typing the following line in a Unix terminal:

alias wget='wget --no-check-certificate' 

However, when I execute shell scripts .sh that include wget command, the original wget is used not the aliased one. How can I resolve this issue?

1
  • Consider including your alias command in either of ~/.bashrc, ~/.bash_profile, /etc/profile Commented Feb 17, 2017 at 8:58

1 Answer 1

3

You have to ensure your alias is defined, where the Shell-script is also sourcing it. If you are using Bash and the Shell-script is using /bin/bash as interpreator, putting into file .bashrc might bei a good idea.

However, --no-check-certificate is in about 99.9% of all cases a very bad idea as SSL is there for a reason.

Also I recommend not to overwrite common commands with custom aliases as this might change behavior of tools a script is relying on in unexpected way. I really recommend to fix up the environment so you don't need this dirty hack.

Sign up to request clarification or add additional context in comments.

8 Comments

wget --no-check-certificate https://github.com/ampl/mp/archive/1.3.0.tar.gz should output a 1.3.0.tar.gz file, but is outputting a 1.3.0 file. Is this issue caused by the --no-check-certificate option?
No it is not and it's also not true
wget --no-check-certificate https://github.com/ampl/mp/archive/1.3.0.tar.gz makes a 1.3.0.tar.gz file on linux, but makes a 1.3.0 file in msys. Why? The output should be 1.3.0.tar.gz otherwise the next lines of my .sh script break.
If you need a exact file name use -O file/—output-document=file and for gods sake: Read the documentation of wget.
Without using --no-check-certificate option I get the ERROR: cannot verify github.com's certificate. So how can I resolve the issue without using --no-check-certificate
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.