-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc.docker
More file actions
52 lines (42 loc) · 1.03 KB
/
bashrc.docker
File metadata and controls
52 lines (42 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# See /etc/bash.bashrc
LOG=/tmp/setup.$$.log
touch $LOG
chmod 666 $LOG
# based on control group v1 or v2
#grep docker /proc/1/cgroup >> $LOG
#if [ $? != 0 ]; then
if [ ! -f /.dockerenv ]; then
echo "NOT IN CONTAINER"
exit -1
fi
[ -z "$PS1" ] && return
shopt -s checkwinsize
# docker will probably set TERM=xterm-256color
# use docker exec -e INSIDE_EMACS to pass this from emacs subshell
# See docker.sh:conn_shell
if [ -z $INSIDE_EMACS ]; then
export TERM=linux
# simple bash prompt
export PS1='\u:\!> '
# xterm shell
# set background to black
echo -e "\e[m"
# set xterm title
PROMPT_COMMAND='echo -ne "\033]0;Docker\007"'
# change xterm title
set_title() {
# symbolic escape codes
PROMPT_COMMAND='echo -ne "\e]0;"'$1'"\a"'
}
echo IN gnome-shell
else
# simple bash prompt
export PS1='\u[emacs]\!> '
# emacs interactive subshell
export TERM=dumb
# emacs subshell does not like pagers
export PAGER=/bin/cat
echo IN emacs subshell
fi
alias h="history"