I am trying to use % host or % dig in script file. To extract source code of a website. For example:
% host askubuntu.comBut I execute file I get this error:
fg: no job controlWhat should I do?
01 Answer
It's hard to be definitive without the context of what you're trying to do, however it is likely that you are copying commands from a book or website that uses % to indicate the shell prompt - it is not part of the command, and you are not meant to type it. The commands should probably just be
host askubuntu.comor
dig askubuntu.comYou're getting the error because % has a special meaning in the bash shell, where %n used to bring the nth backgrounded process into the foreground. Specifically, you're getting fg: no job control because job control is disabled by default in non-interactive shells.