Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sudo: eval: command not found

I have installed minikube on my system and minikube start works as expected for me. When I want to use local docker images and hence trying to run sudo eval $(minikube docker-env).

This gives me an error:

sudo: eval: command not found

Any guidance or solution for this? I am running this on MacOS Mojave.

like image 222
PRERNA AGARWAL Avatar asked Jul 18 '19 06:07

PRERNA AGARWAL


People also ask

How use eval in Linux?

eval is a built in linux or unix command. The eval command is used to execute the arguments as a shell command on unix or linux system. Eval command comes in handy when you have a unix or linux command stored in a variable and you want to execute that command stored in the string.

What is the eval command?

On a Unix or Linux system, the eval command is used to run the arguments as a shell command. When you have a Unix or Linux command saved in a variable and wish to run that command, the eval command is useful. The command evaluates the argument first, then executes the command it contains.

What is eval command in Mac?

Evaluate several commands/arguments. Syntax eval arg ... The args are read and concatenated together into a single command. This command is then read and executed by the shell, and its exit status is returned as the value of eval.

What is eval command in bash?

On Unix-like operating systems, eval is a builtin command of the Bash shell. It concatenates its arguments into a single string, joining the arguments with spaces, then executes that string as a bash command.


Video Answer


3 Answers

You use sudo eval $(minikube docker-env), sudo: eval: command not found this means eval not found. eval is an built-in in shell, so when sudo without -s it will surely tell you this error, like next:

shubuntu1@shubuntu1:~/777$ sudo eval
sudo: eval: command not found
shubuntu1@shubuntu1:~/777$ sudo -s eval
shubuntu1@shubuntu1:~/777$
  • If you want to execute with root account:

    $ sudo -s -H
    $ eval $(minikube docker-env)
    
  • If you just intend to execute with current account:

    $ eval $(minikube docker-env)
    
like image 53
atline Avatar answered Oct 15 '22 08:10

atline


Ran into same issue while setting up the jenkins workflow. Below solution worked for me:

Instead of:

eval $(minikube docker-env)

Try using:

sudo -s eval $(minikube docker-env)
like image 43
Abhishek Sinha Avatar answered Oct 15 '22 07:10

Abhishek Sinha


Others coming here could get this error for an entirely different reason as the accepted answer. In my case the minikube cluster was not running. The error you get in this case is also command not found.

Just run the command: minikube docker-env and if you get the error: The control plane node must be running for this command just start it using minikube start and re-run the command eval $(minikube docker-env). It should work this time.

like image 45
sebastienhamel Avatar answered Oct 15 '22 07:10

sebastienhamel