Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jul 2008 09:45:10 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        EdwardKing <zhangsc@neusoft.com>
Cc:        FreeBSD <freebsd-questions@freebsd.org>, Fernando =?utf-8?Q?Apestegu=C3=ADa?= <fernando.apesteguia@gmail.com>
Subject:   Re: How to change process status?
Message-ID:  <20080722144508.GF19044@dan.emsphone.com>
In-Reply-To: <00e401c8eafc$bf4ef4a0$3f83a8c0@neusofteaf5839>
References:  <00d501c8eafa$174daff0$3f83a8c0@neusofteaf5839> <1bd550a00807202332g69a71b66j8c985dc5f61e22e5@mail.gmail.com> <00e401c8eafc$bf4ef4a0$3f83a8c0@neusofteaf5839>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jul 21), EdwardKing said:
> From: "Fernando ApesteguĂ­a" <fernando.apesteguia@gmail.com>
> > On 7/21/08, EdwardKing <zhangsc@neusoft.com> wrote:
> >> I make a process running in background,like follows:
> >> $./a.out &
> >>
> >> I want to know how to change a.out from backgound to foreground
> >> and how to stop it?
> > 
> > with "fg" and the number the shell returns after you placed the
> > process in the background. Let's say:
> > 
> > $./a.out &
> > [1] 27537
> > 
> > fg %1
> > 
> > -- Here the shell will bring the process to the foreground --
> > 
> > Now you can stop it with Ctrl-c for instance.
> 
> I use FreeBSD7.0
> 
> $./a.out &
> $
> 
> There is show nothing,like such as [1] 27537
> Why? 

/bin/sh doesn't print the job number when you background a process.  You
can use the "jobs" command to list all backgrounded and suspended jobs. 
In your case, you only have one job, so you can just run "fg %1" or
even "fg".

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080722144508.GF19044>