0

I have added a git pull & to my bashrc to keep a particular project always up to date!

However this means every time I open a terminal I get a message like

[17]+ Running git pull

And a few seconds later

[17] Done

Is there a way to stop this output? I'm already sending all output to dev null so the full command is git pull >/dev/null 2>&1 &

5 Answers 5

2

The messages on screen are the result of backgrounding the job, not the job itself.

Try this:

#!/bin/bash

exec &> /dev/null
git pull

In this variant, the process backgrounding the job is a script that already redirects all output.

Of course, such a command should really go in your bash_login, or in your .profile, not in .bashrc.

0

You could use at(1) or even batch(1) to start your command:

echo git pull | at now 2>/dev/null

This way it would also not receive a SIGHUP if you log out immediately. The 2>/dev/null prevents the message job 1334584295.a at Mon Apr 16 15:51:35 2012 to be written by the at command.

You may have to add your user name to /usr/lib/cron/at.allow (location of this file may differ with our flavour of UNIX/Linux).

0

use nohup:

nohup git pull &
0

Use a subshell and mute STDOUT and STDERR:

(&>/dev/null git pull &)
-1

I found that using a subshell silences the backgrounding of the job:

(git pull &)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .