Skip to main content
bash is not central to the question
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 267

I am trying to execute sudo command inside a bsshbash script.

#!/bin/bash

sudo node app.js

and it throws me :

sudo: node: command not found

If I try to execute only node app.js (without sudo ),it runs ok.

If I try to just run sudo -h , it runs ok againprints the sudo help.

But , when I am trying the sudo node app.js it throws me the error.

I am trying to execute sudo command inside a bssh script.

#!/bin/bash

sudo node app.js

and it throws me :

sudo: node: command not found

If I try to execute only node app.js (without sudo ),it runs ok.

If I try to just run sudo -h , it runs ok again.

But , when I am trying the sudo node app.js it throws me the error.

I am trying to execute sudo command inside a bash script.

#!/bin/bash

sudo node app.js

and it throws me :

sudo: node: command not found

If I try to execute only node app.js (without sudo ),it runs ok.

If I try to just run sudo -h , it prints the sudo help.

But , when I am trying the sudo node app.js it throws me the error.

Source Link
George
  • 545
  • 3
  • 10
  • 17

command not found using sudo in script

I am trying to execute sudo command inside a bssh script.

#!/bin/bash

sudo node app.js

and it throws me :

sudo: node: command not found

If I try to execute only node app.js (without sudo ),it runs ok.

If I try to just run sudo -h , it runs ok again.

But , when I am trying the sudo node app.js it throws me the error.