Difference between revisions of "Category:Bash"

From wiki
Jump to navigation Jump to search
(Created page with "Bash is a *nix shell. Much more is still in [https://unix.antiperfect.org the antiperfect unix site]. To check within a startup script (like .bashrc) whether or not Bash is r...")
 
(Redirected page to Category:Linux/Unix)
Tag: New redirect
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
Bash is a *nix shell. Much more is still in [https://unix.antiperfect.org the antiperfect unix site].
+
#REDIRECT [[Category:Linux/Unix]]
 
 
To check within a startup script (like .bashrc) whether or not Bash is running interactively. Test if $- has an 'i' in it or if $PS1 (the prompt) exists.
 
 
 
<syntaxhighlight lang=bash>
 
case "$-" in
 
*i*) echo This shell is interactive ;;
 
*) echo This shell is not interactive ;;
 
esac
 
 
 
if [ -z "$PS1" ]; then
 
        echo This shell is not interactive
 
else
 
        echo This shell is interactive
 
</syntaxhighlight>
 

Latest revision as of 11:17, 15 February 2023

This category currently contains no pages or media.