User Tools

Site Tools


bash:check_if_bash_is_running_in_interactive_mode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
bash:check_if_bash_is_running_in_interactive_mode [2021/02/04 10:42] peterbash:check_if_bash_is_running_in_interactive_mode [2021/02/04 11:08] (current) – [BASH - Check if bash is running in interactive mode] peter
Line 5: Line 5:
 then then
   do_interactive_stuff   do_interactive_stuff
 +fi
 +
 +
 +if [ "$-#*i" == "$-" ]; then
 +  ...
 fi fi
 </code> </code>
Line 16: Line 21:
  
 ---- ----
 +
 +====== Check if standard input is a TTY ======
  
 <code bash> <code bash>
Line 53: Line 60:
  
 writes Y writes Y
 +
 +<WRAP info>
 +**NOTE:**  This also verifies that the standard input is a TTY; although it can be related but it is NOT the same as the shell's interactive mode, which is requested and indicated by shell's "-i" flag.
 +</WRAP>
 +
  
 ---- ----
bash/check_if_bash_is_running_in_interactive_mode.1612435374.txt.gz · Last modified: 2021/02/04 10:42 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki