Bash - The GNU Bourne Again Shell

From IThelp

GNU Bash is the default command interpreter on many GNU / Linux systems. Many scripts are written in Bash, and together with the other tools from GNU / Linux installations can Bash be used for many things.

Bash is also the default shell on many GNU / Linux systems. The shell receives commands from the user in a terminal or console. UiB offers Bash or tcsh as the default shell on GNU / Linux and UNIX systems.

Customizing the shell

Bash reads some files on startup and when closing. You can read more about that in the documentation for Bash. For example, try the command man bash or info bash on a GNU / Linux system.

The files in your home directory controls the settings for Bash:

  • .profile
  • .bash_profile
  • .bashrc
  • .bash_logout

If you can not find those files there (ls -al ~) you can copy the templates for them from the directory /etc/skel.

$ cd ~
$ ls .bash*
ls: cannot access .bash*: No such file or directory
$ cp /etc/skel/.bash* ~

If the files are there, you must of course not overwrite them, then you will lose the settings made ​​in the files before.

Environment Variables

A common method to set up environment variables in bash is to add a line for each variable in the file ~/.bashrc, as follows:

$ export test = "This is a test"

This gives the variable $test value 'This is a test'. It is common for system variables to use CAPS, and that all other variables not use all capital letters.