The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 12-04-2005
bakunin bakunin is offline
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,032
A Korn shell in interactive mode has the "-i" flag set, hence:

Code:
if [ $(print - "$-" | grep -c "i") -gt 0 ] ; then
     print - "shell is interactive"
else
     print - "shell is non-interactive"
fi
bakunin

Last edited by bakunin; 12-04-2005 at 05:00 PM.
Reply With Quote