Bash 使用输入在后台运行进程
我有一个需要输入密码的命令。一旦输入密码,我需要它在后台运行。我知道如果我在末尾加上“&”,我就能做到。我遇到的问题是,当我以这种方式运行它时,我从未得到密码提示。它只是坐在那里,最终超时。当我在没有“&”的情况下运行它时。我确实会被提示输入密码 我在Mac上运行这个Bash 使用输入在后台运行进程,bash,macos,terminal,command-line-interface,Bash,Macos,Terminal,Command Line Interface,我有一个需要输入密码的命令。一旦输入密码,我需要它在后台运行。我知道如果我在末尾加上“&”,我就能做到。我遇到的问题是,当我以这种方式运行它时,我从未得到密码提示。它只是坐在那里,最终超时。当我在没有“&”的情况下运行它时。我确实会被提示输入密码 我在Mac上运行这个 sudo /usr/local/bin/openfortivpn -c /usr/local/Cellar/openfortivpn/my-config (gets prompted for password, then conn
sudo /usr/local/bin/openfortivpn -c /usr/local/Cellar/openfortivpn/my-config (gets prompted for password, then connects me to vpn)
sudo /usr/local/bin/openfortivpn -c /usr/local/Cellar/openfortivpn/my-config & (never prompts me for password. Command just sits there and eventually times out)
这可能会回答您的问题——“如何在不停止作业的情况下将作业发送到后台?”: