Bash (Unix shell): Difference between revisions

Line 44: Line 44:
<syntaxhighlight lang="bash">
<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\]\$'
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>
==Brace Expansion==
When you type the following:
<syntaxhighlight lang="bash">
echo {red,green,blue}_apple
</syntaxhighlight>
bash will print out
<pre>
red_apple green_apple blue_apple
</pre>
If you want to save this into a variable, you can save it as an array:
<syntaxhighlight>
APPLES=({red,green,blue}_apple)
echo "${APPLES[@]}"
</syntaxhighlight>
</syntaxhighlight>