1
0
Fork 0
mirror of synced 2024-12-22 06:41:07 -05:00

added word boundaries when replacing uptime_xxx variables (2)

use perl instead of sead as on macOS sed doesn't support \b to match word boundaries
This commit is contained in:
Gregory Pakosz 2021-10-31 20:55:41 +01:00
parent 0da7d5c3db
commit 0ad7f141dc

View file

@ -1242,20 +1242,20 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime' # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime'
# case "$status_left $status_right" in # case "$status_left $status_right" in
# *'#{uptime_'*|*'#{?uptime_'*) # *'#{uptime_'*|*'#{?uptime_'*)
# status_left=$(echo "$status_left" | sed -E \ # status_left=$(echo "$status_left" | perl -p -e '
# -e 's/#\{(\?)?uptime_y\b/#\{\1@uptime_y/g' \ # ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g
# -e 's/#\{(\?)?uptime_d\b/#\{\1@uptime_d/g' \ # ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ # ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/
# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ # ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g
# -e 's/#\{(\?)?uptime_m\b/#\{\1@uptime_m/g' \ # ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g
# -e 's/#\{(\?)?uptime_s\b/#\{\1@uptime_s/g') # ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g')
# status_right=$(echo "$status_right" | sed -E \ # status_right=$(echo "$status_right" | perl -p -e '
# -e 's/#\{(\?)?uptime_y\b/#\{\1@uptime_y/g' \ # ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g
# -e 's/#\{(\?)?uptime_d\b/#\{\1@uptime_d/g' \ # ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ # ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/
# -e 's/#\{(\?)?uptime_h\b/#\{\1@uptime_h/g' \ # ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g
# -e 's/#\{(\?)?uptime_m\b/#\{\1@uptime_m/g' \ # ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g
# -e 's/#\{(\?)?uptime_s\b/#\{\1@uptime_s/g') # ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g')
# interval=60 # interval=60
# case "$status_left $status_right" in # case "$status_left $status_right" in
# *'#{@uptime_s}'*) # *'#{@uptime_s}'*)