Ubuntu – I have a problem when using “export” command


When I put sudo "export PROXY_LOCAL_NET_IP=" I get the following error:

sudo: export: command not found

What should I do to resolve this problem?

Best Answer

You cannot use shell builtins with sudo. Only command corresponding to valid files will be executed through sudo. The correct syntax for sudo is : sudo [options] [filename]

Export is an inside (builtin) command of the Bash shell and possibly some other too.

Also, note that there is no sense to do the action of export via sudo, it has to be done under your user id to be applicable to your shell and its child processes.

If you switch to the root user to do this, you will have to do the rest of your operation as root : this is not recommended. Because if you exit the root shell, the assignement done by export will be lost.