Sunday, January 2, 2011

About Bash

Bash loads different files located in your home directory

Cygwin Setup

You can do the setup using config files.

Your home directory should contain three initialization files that control the behavior of bash:


The Cygwin base installation creates stub files when you start bash for the first time.

.profile (other names are valid, see the bash man page) contains bash commands, executed when bash is started as login shell, e.g. from the command bash --login.
This is a useful place to define and export environment variables and bash functions that will be used by bash and the programs invoked by bash. It is a good place to redefine PATH if needed. We recommend adding a ":." to the end of PATH to also search the current working directory (contrary to DOS, the local directory is not searched by default). Also to avoid delays you should either unset MAILCHECK or define MAILPATH to point to your existing mail inbox.

.bashrc is similar but is executed each time an interactive bash shell is launched. It serves to define elements that are not inherited through the environment, such as aliases. If you do not use login shells, you may want to put the contents of .profile as discussed above in this file instead.

For example, shopt -s nocaseglob, will allow bash to glob filenames in a case-insensitive manner. Note that .bashrc is not called automatically for login shells, you may want to source it inside the .profile file.

.inputrc controls how programs using the readline library (including bash) behave. It is loaded automatically. For full details see the Function and Variable Index section of the GNU readline manual. Consider the following settings:
# Ignore case while completing
set completion-ignore-case on
# Make Bash 8bit clean
set meta-flag on
set convert-meta off
set output-meta on
The first command makes filename completion case insensitive (can be convenient in a Windows environment). The next three commands allow bash to display 8-bit characters (useful for languages with accented characters). Note that tools that do not use readline for display, such as less and ls, require additional settings, which could be put in your .bashrc:
alias less='/bin/less -r'
alias ls='/bin/ls -F --color=tty --show-control-chars'


HTMLCode Content