author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 22 Feb 2016 13:34:55 +0200 | |
changeset 1911 | 870693ce6ff0 |
parent 1905 | fba288d59662 |
child 1912 | 8b81a8f0f692 |
permissions | -rw-r--r-- |
1069 | 1 |
.. -*- coding: utf-8; -*- |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1069
diff
changeset
|
2 |
.. include:: HEADER.rst |
1069 | 3 |
|
4 |
======= |
|
5 |
Bash. |
|
6 |
======= |
|
1346
a2fbf50a43f4
Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
7 |
.. contents:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
8 |
:local: |
1069 | 9 |
|
10 |
How override PS1, PS2? |
|
11 |
====================== |
|
12 |
||
13 |
When loading bash read ~/.bash_profile and ~/.bashrc. |
|
14 |
||
15 |
Put at end of these files:: |
|
16 |
||
17 |
PS1='\u@\H$ ' |
|
18 |
||
19 |
When xterm start bash - it start as non-login. So ~/.bash_profile and ~/.bashrc |
|
20 |
didn't read. To workaround this use:: |
|
21 |
||
22 |
$ xterm -e bash -i -c "mc -x" |
|
23 |
||
24 |
That make bash interactive and init file was readed. |
|
25 |
||
26 |
Command history. |
|
27 |
================ |
|
28 |
||
29 |
Bash allow accessing to command that you type previously. There are several |
|
30 |
options to control command history behavior. Set corresponding variables in |
|
31 |
your ~/.bashrc file (which is read by interactive shell):: |
|
32 |
||
33 |
# ignorespace do not save lines that start with space |
|
34 |
# erasedups all previous lines matching the current line to be removed from |
|
35 |
# the history list before that line is saved |
|
36 |
export HISTCONTROL=igrorespace:erasedups |
|
37 |
export HISTIGNORE=" ?cd *":"e *":"sudo mv *":"sudo rm *":"sudo cp *":"sudo mkdir *":"sudo chmod *":"sudo chown *":ls:pwd:"vlc*" |
|
38 |
||
39 |
There are another options, with default values (which satisfy my needs, so |
|
40 |
I don't put they to ~/.bashrc):: |
|
41 |
||
42 |
export HISTFILE=~/.bash_history # where is command history stored |
|
43 |
export HISTFILESIZE=500 # how many lines been in $HISTFILE |
|
44 |
export HISTSIZE=500 # how many lines been stored in bash process |
|
45 |
||
46 |
mc (GNU Midnight Commander). |
|
47 |
---------------------------- |
|
48 |
||
49 |
You can also set special history rules for mc subshell in ~/.mc/bashrc file. |
|
50 |
||
51 |
Bash history. |
|
52 |
============= |
|
53 |
||
54 |
http://wiki.bash-hackers.org/scripting/bashchanges |
|
55 |
This article is an incomplete overview of changes to Bash over |
|
56 |
the time. |
|
57 |
||
58 |