Execute single command in shell script without sudo

后端 未结 2 1020
梦谈多话
梦谈多话 2021-01-11 12:12

I have a simple shell script that is run with sudo as most of the script requires it, yet one of the commands in the script is a Homebrew install, which cannot be executed w

2条回答
  •  -上瘾入骨i
    2021-01-11 12:39

    Instantiate the shell using

    sudo -u $USER_NAME bash

    and execute the shell script by calling,

    ./program.sh

提交回复
热议问题