TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SCALUG] Re: [TCLUG:6728] csh question



A sincere thanks to all that replied to my call for help.

For anyone with this problem in the future, the jobs command (AFAIK) only
list the background jobs of the current process, not if the
current process is a background job itself. "jobs" run in a csh script
will produce no output unless the script spawned some background jobs,
which isn't what I was looking for (not that you could tell from my
initial post).

I think there are versions of "ps" that will allow you to compare some
process group id to some other process id and you will get a yes or no
answer wether it is a background process, but the person I am asking this
for has a version of "ps" that doesn't provide all the info needed. 

Bummer. :-( 

Thank you again,

Troy


I searched for an answer to the same question some time ago.  The only
solution I found that worked (at the time) was to "tell" the
process being launched that it was a background process by use of a
command line argument and a variable inside the shell process. 

   By "you" I meant the background process (sorry for the ambiguity). It
is 
   to answer a question for someone who is running a csh script and wants 
   it to behave one way when it is the foreground (get some input from the 
   user) and another way when it runs in the background. I "wrote" a C 
   utility that tests for a controlling tty (can I open /dev/tty?), but 
   just being in the background or foreground of a controlling process is 
   different. :-/ 

   Troy 

   > > How would one, in csh, find out if you were a background process? 
   > I'm not sure what you mean by "you".  If your refering to a
background 
   > terminal, you wouldn't be able to enter anything anyway.  To see you 
   > background processes, though, you can type "jobs".  Alternatively you
can 
   > grep for things in the process list. 
   > > Troy 

On Mon, 28 Jun 1999, Chris Kesler wrote:
> Try the 'jobs' command.
> On Fri, 25 Jun 1999, Troy A Johnson wrote:
> > How would one, in csh, find out if you were a background process?

############################################################
# Troy Andrew Johnson
# john1536@tc.umn.edu  or  troy.johnson@health.state.mn.us
# http://umn.edu/~john1536/