home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] how does one test if bash shell is interactive

  • Subject: Re: [OCLUG-Tech] how does one test if bash shell is interactive
  • From: Vic Gedris <vic [ at ] gedris [ dot ] org>
  • Date: Tue, 26 Jul 2005 12:57:03 -0400
On Tue, Jul 26, 2005 at 12:45:33PM -0400, michael ondrechak wrote:
> Is there a way for a bash script to test if it's being run from an
> interactive shell? That is, I want to be able to test whether the
> script was started as:
> 
> $ script
> 
> or as
> 
> $ script &
> 
> I looked at bash's shopt command and while it discusses 'interactive'
> shells, I didn't see anything that allows me to test for the
> condition.

Michael,

This should answer it:

http://theory.uwinnipeg.ca/localfiles/infofiles/bash/bashref_54.html

-Vic

-- 
Vic Gedris        |  Web: http://vic.gedris.org/
Toronto, Ontario  |  E-mail: vic-at-gedris-dot-org
CANADA            |  Encrypted email preferred (D77B43FB)

Attachment: signature.asc
Description: Digital signature