Bash (Unix shell): Difference between revisions

From David's Wiki
Created page with "Bash Scripting ==Getting Started== Here is an example bash script <syntaxhighlight lang="bash"> #!/bin/bash # A simple variable example myvariable=Hello anothervar=Fred ech..."
 
No edit summary
Line 14: Line 14:


==Usage==
==Usage==
==<code>.bashrc</code>==
Your <code>.bashrc</code> file will be loaded for each terminal.<br>
==Presentation of Shell Variable==
Add the following to show your
<syntaxhighlight lang="bash">
PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$'
</syntaxhighlight>

Revision as of 20:54, 26 December 2019

Bash Scripting


Getting Started

Here is an example bash script

#!/bin/bash
# A simple variable example
myvariable=Hello
anothervar=Fred

echo $myvariable $anothervar

Usage

.bashrc

Your .bashrc file will be loaded for each terminal.

Presentation of Shell Variable

Add the following to show your

PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$'