Skip to content

Commit

Permalink
Merge pull request #59 from bug-ware/oldbash
Browse files Browse the repository at this point in the history
Compatibility with bash version before 4.4
  • Loading branch information
chris-marsh committed Mar 14, 2021
2 parents 3854169 + 1eaaa12 commit 67f7085
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pureline
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ function newline_segment {
# code to run before processing $PROMT_COMMAND
function pureline_pre {
__return_code=$? # save return code of last command
echo -ne "\e]2;${PL_TITLEBAR@P}\a" # set the gui window title
if (( ${BASH_VERSINFO[0]:-0} > 4 || (${BASH_VERSINFO[0]:-0} == 4 && ${BASH_VERSINFO[1]:-0} >= 4) )); then
echo -ne "\e]2;${PL_TITLEBAR@P}\a" # set the gui window title
else
echo -ne "\e]2;'${PL_TITLEBAR}'\a" # set the gui window title
fi
}

# -----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion segments/pwd_segment
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function pwd_segment {
local bg_color="$1"
local fg_color="$2"
#local content="\w"
local content="${PWD/#$HOME/\~}" #$(pwd)
local content="${PWD/#$HOME/~}" #works for bash < 4.4 #$(pwd)
content="${content/#$HOME/\~}" #escaping needed for bash >= 4.4
if [ "$PL_PATH_TRIM" -eq 1 ]; then
# local content="\W"
content="${content##*/}"
Expand Down

0 comments on commit 67f7085

Please sign in to comment.