Use $HOSTNAME instead of $(hostname) in .bash*
This commit is contained in:
parent
724b92a586
commit
233680cd76
2 changed files with 4 additions and 4 deletions
|
@ -121,7 +121,7 @@ hash screen >/dev/null 2>&1 && {
|
||||||
screen_attach
|
screen_attach
|
||||||
|
|
||||||
# Output some screen info.
|
# Output some screen info.
|
||||||
export SCREENDIR="$HOME/.screen-$(hostname --short)"
|
export SCREENDIR="$HOME/.screen-${HOSTNAME%%.*}"
|
||||||
if [[ ! -e ~/.hushlogin ]]; then
|
if [[ ! -e ~/.hushlogin ]]; then
|
||||||
if [[ ! -z "$STY" ]]; then
|
if [[ ! -z "$STY" ]]; then
|
||||||
echo "Screen $STY, window $WINDOW."
|
echo "Screen $STY, window $WINDOW."
|
||||||
|
|
6
.bashrc
6
.bashrc
|
@ -158,7 +158,7 @@ screen_attach() {
|
||||||
# Only continue if it's not a remote connection, and not inside screen already.
|
# Only continue if it's not a remote connection, and not inside screen already.
|
||||||
[[ -z "$SSH_TTY" ]] && [[ -z "$STY" ]] && {
|
[[ -z "$SSH_TTY" ]] && [[ -z "$STY" ]] && {
|
||||||
TTY="$(tty | cut -d/ -f3-)"
|
TTY="$(tty | cut -d/ -f3-)"
|
||||||
SCREENS="$(screen -list | fgrep -v "Dead" | fgrep "$HOSTNAME" | fgrep "${TTY//\//-}")"
|
SCREENS="$(screen -list | fgrep -v "Dead" | fgrep "${HOSTNAME%%.*}" | fgrep "${TTY//\//-}")"
|
||||||
case "$(echo "${SCREENS:--n}" | wc -l)" in
|
case "$(echo "${SCREENS:--n}" | wc -l)" in
|
||||||
0)
|
0)
|
||||||
# No screens found - start a new instance.
|
# No screens found - start a new instance.
|
||||||
|
@ -166,7 +166,7 @@ screen_attach() {
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
# Just one screen - reconnect.
|
# Just one screen - reconnect.
|
||||||
screen -dr "${TTY//\//-}.$HOSTNAME"
|
screen -dr "${TTY//\//-}.${HOSTNAME%%.*}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Multiple screens - output a list
|
# Multiple screens - output a list
|
||||||
|
@ -185,7 +185,7 @@ IGNOREEOF=0
|
||||||
|
|
||||||
# History control.
|
# History control.
|
||||||
HISTCONTROL="ignoredups"
|
HISTCONTROL="ignoredups"
|
||||||
HISTFILE="$HOME/.bash_history-$(hostname --short)"
|
HISTFILE="$HOME/.bash_history-${HOSTNAME%%.*}"
|
||||||
HISTFILESIZE=100000
|
HISTFILESIZE=100000
|
||||||
HISTIGNORE="bg:bg *:fg:fg *:jobs:exit:clear:history"
|
HISTIGNORE="bg:bg *:fg:fg *:jobs:exit:clear:history"
|
||||||
HISTSIZE=-1
|
HISTSIZE=-1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue