author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 01 Jan 2024 20:53:49 +0200 | |
changeset 1039 | 78cdb4a057e3 |
parent 1030 | 2972a4eec5ef |
permissions | -rw-r--r-- |
654
88c5d34d3032
Mark file as sh script for Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
653
diff
changeset
|
1 |
# Bash and Zsh common env var settings. -*- sh -*- |
250
405b343c1214
Add remainder how debug.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
242
diff
changeset
|
2 |
|
405b343c1214
Add remainder how debug.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
242
diff
changeset
|
3 |
# set -x |
405b343c1214
Add remainder how debug.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
242
diff
changeset
|
4 |
# set -u |
11
339675ac5fd3
Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
|
927
839438e30b73
Changed EDITOR to vim. Cygwin's vi is very primitive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
926
diff
changeset
|
6 |
export EDITOR=vim |
11
339675ac5fd3
Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
|
339675ac5fd3
Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
8 |
# XXX vim and gnome-terminal have support for 256 colours in fedora 8 at least |
339675ac5fd3
Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
# Note debian/ubuntu users should install the ncurses-term package to support this |
339675ac5fd3
Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
# export TERM=xterm-256color |
339675ac5fd3
Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
|
285
60fc251ec270
Bash string comparison does not require hack.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
280
diff
changeset
|
12 |
if [[ $OSTYPE = cygwin ]]; then |
258
e3c456cab7ba
Use only $OSTYPE to detect Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
257
diff
changeset
|
13 |
# Avoid permission problem in Cygwin. |
e3c456cab7ba
Use only $OSTYPE to detect Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
257
diff
changeset
|
14 |
umask 0000 |
32
031655c93305
Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
30
diff
changeset
|
15 |
fi |
126
d342461b401b
Point PATH, MANPATH, INFOPATH to '~/usr'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
109
diff
changeset
|
16 |
|
594
521916a26ee2
Fix: forget export variable to environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
541
diff
changeset
|
17 |
export TIME_STYLE=long-iso |
521916a26ee2
Fix: forget export variable to environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
541
diff
changeset
|
18 |
|
1018
831e2c1bf980
Completed migration from ~/devel to ~/work.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1005
diff
changeset
|
19 |
# Easy cd to often used dirs. |
1020
ee4b6963627e
Added Windows' directory "Documents" to CDPATH for better integration with WSL 1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1018
diff
changeset
|
20 |
export CDPATH=.:$HOME:$HOME/work:$HOME/my:$HOME/Documents |
300
f7c19d2b4263
Move CDPATH place hold to use it from MC after xinit load...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
299
diff
changeset
|
21 |
|
989
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
22 |
my_path_prune() { |
990
582cddcfb6a6
Fixed horrible Bash regex performance matching with two placeholders. Instead use fast one and extract remaining part.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
989
diff
changeset
|
23 |
if [[ :$1: =~ (.*):$2: ]]; then |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
24 |
local left=${BASH_REMATCH[1]} |
990
582cddcfb6a6
Fixed horrible Bash regex performance matching with two placeholders. Instead use fast one and extract remaining part.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
989
diff
changeset
|
25 |
local right=${1:$((${#left} + ${#2} + 1))} |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
26 |
[[ ${left:0:1} = : ]] && left=${left:1} |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
27 |
[[ ${right: -1} = : ]] && right=${right:0: -1} |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
28 |
if [[ -z $left ]]; then |
989
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
29 |
my_path_prune=$right |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
30 |
elif [[ -z $right ]]; then |
989
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
31 |
my_path_prune=$left |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
32 |
else |
989
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
33 |
my_path_prune=$left:$right |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
34 |
fi |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
35 |
else |
989
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
36 |
my_path_prune=$1 |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
37 |
fi |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
38 |
} |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
39 |
|
989
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
40 |
my_path_preappend() { |
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
41 |
my_path_prune "$PATH" "$1" |
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
42 |
PATH=$1:$my_path_prune |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
43 |
} |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
44 |
|
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
45 |
# For my "cygrun.exe" wrapper to work it should be behind shebang scripts in the PATH. |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
46 |
my_path_preappend ~/usr/bin |
984
54b3a34b8f21
Include /usr/local/bin into PATH for "pip install" to be available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
982
diff
changeset
|
47 |
# ~/.local/bin is default PATH for "pip install --user $PKG". |
988
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
48 |
my_path_preappend ~/.local/bin |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
49 |
my_path_preappend /usr/local/bin |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
50 |
my_path_preappend /usr/bin |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
51 |
my_path_preappend /bin |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
52 |
my_path_preappend /usr/sbin |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
53 |
my_path_preappend /sbin |
b5c31b623dec
Rearrange default UNIX PATHs priority. Under Cygwin that helps with placing Cygwin's paths before Windows'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
986
diff
changeset
|
54 |
export PATH |
989
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
55 |
unset -f my_path_preappend |
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
56 |
unset -f my_path_prune |
5b3759d3d789
Use variable to return function result for better performance on Cygwin. Cleanup helper functions from the environment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
988
diff
changeset
|
57 |
unset -v my_path_prune |
299
2771c1f6f3c5
Add '/usr/sbin' to 'PATH' and '$HOME/usr/lib' to 'LD_LIBRARY_PATH'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
285
diff
changeset
|
58 |
|
980
9f36844d6441
Combined dependent check into "elif".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
979
diff
changeset
|
59 |
if [[ -z $LD_LIBRARY_PATH ]]; then |
9f36844d6441
Combined dependent check into "elif".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
979
diff
changeset
|
60 |
LD_LIBRARY_PATH=$HOME/usr/lib |
9f36844d6441
Combined dependent check into "elif".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
979
diff
changeset
|
61 |
elif [[ :$LD_LIBRARY_PATH: != *:$HOME/usr/lib:* ]]; then |
299
2771c1f6f3c5
Add '/usr/sbin' to 'PATH' and '$HOME/usr/lib' to 'LD_LIBRARY_PATH'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
285
diff
changeset
|
62 |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":$HOME/usr/lib |
2771c1f6f3c5
Add '/usr/sbin' to 'PATH' and '$HOME/usr/lib' to 'LD_LIBRARY_PATH'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
285
diff
changeset
|
63 |
fi |
126
d342461b401b
Point PATH, MANPATH, INFOPATH to '~/usr'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
109
diff
changeset
|
64 |
|
798
a976c73e4873
Do not set MANPATH on NetBSD, because there is non-GNU man and it does not
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
797
diff
changeset
|
65 |
case $OSTYPE in |
a976c73e4873
Do not set MANPATH on NetBSD, because there is non-GNU man and it does not
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
797
diff
changeset
|
66 |
netbsd*) ;; # Do nothing, because NetBSD uses non-GNU man. |
a976c73e4873
Do not set MANPATH on NetBSD, because there is non-GNU man and it does not
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
797
diff
changeset
|
67 |
*) |
a976c73e4873
Do not set MANPATH on NetBSD, because there is non-GNU man and it does not
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
797
diff
changeset
|
68 |
if [[ -z $MANPATH ]]; then |
981
79ac660917cb
Replaced regex match with pattern match.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
980
diff
changeset
|
69 |
export MANPATH=$HOME/usr/share/man: |
79ac660917cb
Replaced regex match with pattern match.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
980
diff
changeset
|
70 |
elif [[ :$MANPATH: != *:$HOME/usr/share/man:* ]]; then |
79ac660917cb
Replaced regex match with pattern match.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
980
diff
changeset
|
71 |
export MANPATH=$MANPATH:$HOME/usr/share/man: |
798
a976c73e4873
Do not set MANPATH on NetBSD, because there is non-GNU man and it does not
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
797
diff
changeset
|
72 |
fi |
a976c73e4873
Do not set MANPATH on NetBSD, because there is non-GNU man and it does not
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
797
diff
changeset
|
73 |
;; |
a976c73e4873
Do not set MANPATH on NetBSD, because there is non-GNU man and it does not
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
797
diff
changeset
|
74 |
esac |
126
d342461b401b
Point PATH, MANPATH, INFOPATH to '~/usr'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
109
diff
changeset
|
75 |
|
708
06a040a98984
Detect empty LD_LIBRARY_PATH.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
698
diff
changeset
|
76 |
if [[ -z $INFOPATH ]]; then |
786
2a3e6cf308f2
"~" expanded only on word start. Use "$HOME" instead of ~ for this
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
785
diff
changeset
|
77 |
export INFOPATH=$HOME/usr/share/info: |
981
79ac660917cb
Replaced regex match with pattern match.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
980
diff
changeset
|
78 |
elif [[ :$INFOPATH: != *:$HOME/usr/share/info:* ]]; then |
279
5845d7aa3ca4
Update paths only once.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
79 |
export INFOPATH=$INFOPATH:$HOME/usr/share/info: |
126
d342461b401b
Point PATH, MANPATH, INFOPATH to '~/usr'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
109
diff
changeset
|
80 |
fi |
d342461b401b
Point PATH, MANPATH, INFOPATH to '~/usr'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
109
diff
changeset
|
81 |
|
786
2a3e6cf308f2
"~" expanded only on word start. Use "$HOME" instead of ~ for this
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
785
diff
changeset
|
82 |
export PYTHONSTARTUP=$HOME/.pystartup |
226
97139da73273
Enable python statement readline completion and readline history for interactive Python .
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
221
diff
changeset
|
83 |
|
982
087e216676be
Set Node prefix & cache to local directory on Linux.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
981
diff
changeset
|
84 |
if [[ :$PATH: != *:$HOME/.local/npm:* && $OSTYPE != cygwin ]]; then |
087e216676be
Set Node prefix & cache to local directory on Linux.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
981
diff
changeset
|
85 |
export PATH=$PATH:$HOME/.local/npm |
785 | 86 |
fi |
655
2565437c1410
Set NPM prefix to local user directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
654
diff
changeset
|
87 |
|
912 | 88 |
export RLWRAP_HOME=$HOME/.rlwrap |
89 |
||
924
c171d2b1f725
Made idempotent application of Gradle settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
920
diff
changeset
|
90 |
unset xopt |