3

It may look like this: [2] 2847. I guess the first digit is just an enumeration of processes created from the shell. The second is the PID. Anyway, I never care about that information so it is just annoying to see. Is there a way to turn it off? (I found that set +bm in .bashrc disabled the process termination message.)

2
  • AFAIK no there isn't. Jun 5 '12 at 22:17
  • Alright, good to know so I don't waste time looking. Jun 5 '12 at 22:31
5

The first number is the job index; job-related commands (jobs, fg, etc.) use them. So for example, if you get the output [2] 2847, you could run fg 2 to foreground that job.

As far as I could tell from skimming the source, there isn't a way to disable the message. The one check it does do is to ensure the shell is interactive, so if you run the command in a non-interactive shell you won't get that output. For example, you could run it in a subshell:

$ (your_command &)

That's equivalent to running the command in an entirely different shell though, so it might have other undesired side-effects

If you're willing to patch bash, you can just get rid of that particular output. In bash 4.2 it's in jobs.c on line 1428:

fprintf (stderr, "[%d] %ld\n", job + 1, (long)pid);

It gets called in other circumstances; if you just want it gone for this particular case, you can comment out execute_cmd.c, line 762:

DESCRIBE_PID (last_made_pid);
1
  • Hm, this would be one way: alias skype="(skype &)" - it works, and you don't have to type the extra stuff - but 1) you'd like a general solution, as you never know what tools you'll use, and 2) It'll break those tools for any other usage, say you'd like to add an option flag, so patching is much better. I'll get to it :) Jun 5 '12 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.