Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does "bash:no job control in this shell” mean?

Tags:

linux

bash

I think it's related to the parent process creating new subprocess and does not have tty. Can anyone explain the detail under the hood? i.e. the related working model of bash, process creation, etc?

It may be a very broad topic so pointers to posts are also very appreciated. I've Googled for a while, all the results are about very specific case and none is about the story behind the scene. To provide more context, below is the shell script resulting the 'bash: no job control in this shell'.

#! /bin/bash  while [ 1 ]; do     st=$(netstat -an |grep 7070 |grep LISTEN -o | uniq)     if [ -z $st ]; then         echo "need to start proxy @$(date)"         bash -i -c "ssh -D 7070 -N [email protected] > /dev/null"     else         echo "proxy OK @$(date)"     fi     sleep 3 done 

This line:

bash -i -c "ssh -D 7070 -N [email protected] > /dev/null"

is where "bash:no job control in this shell” come from.

like image 463
luanjunyi Avatar asked Aug 06 '12 00:08

luanjunyi


People also ask

What does no job control in this shell mean?

Without job control, you have the ability to put a job in the background by adding & to the command line. And that's about all the control you have. With job control, you can additionally: Suspend a running foreground job with Ctrl Z. Resume a suspended job in the foreground with fg.

What is job control in bash?

Job control refers to the ability to selectively stop (suspend) the execution of processes and continue (resume) their execution at a later point. A user typically employs this facility via an interactive interface supplied jointly by the system's terminal driver and Bash. The shell associates a job with each pipeline.

How do I fix bash command not found?

Install a package Sometimes when you try to use a command and Bash displays the "Command not found" error, it might be because the program is not installed on your system. Correct this by installing a software package containing the command.


1 Answers

You may need to enable job control:

#! /bin/bash    set -m 
like image 190
Marian Avatar answered Oct 02 '22 17:10

Marian