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