New version, tarball. This fix only impacts bsd sed, but it fixes the line length failure

issue because bsd sed doesn't work with \x1b, but it does when you do:
ESC=$(echo | tr '\n' '\033' )
I found this trick on:
http://unix.stackexchange.com/questions/42321/how-can-i-instruct-bsd-sed-to-interpret-escape-sequences-like-n-and-t

No other changes. Non bsd users, you can ignore this.
This commit is contained in:
inxi-svn 2014-04-03 04:30:30 +00:00
parent f75d42d43d
commit 26e1d560c3
2 changed files with 24 additions and 3 deletions

9
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### Version: 2.1.15 #### Version: 2.1.16
#### Date: 2014-04-01 #### Date: 2014-04-02
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -521,6 +521,7 @@ C2=''
CN='' CN=''
## Always leave these blank, these are only going to be set in inxi.conf files, that makes testing ## Always leave these blank, these are only going to be set in inxi.conf files, that makes testing
## for user changes easier after sourcing the files ## for user changes easier after sourcing the files
ESC='\x1b'
GLOBAL_COLOR_SCHEME='' GLOBAL_COLOR_SCHEME=''
IRC_COLOR_SCHEME='' IRC_COLOR_SCHEME=''
IRC_CONS_COLOR_SCHEME='' IRC_CONS_COLOR_SCHEME=''
@ -825,6 +826,7 @@ initialize_data()
BSD_TYPE='bsd' # all other bsds BSD_TYPE='bsd' # all other bsds
SED_I="-i ''" SED_I="-i ''"
SED_RX='-E' SED_RX='-E'
ESC=$(echo | tr '\n' '\033')
fi fi
fi fi
# now set the script BOOLEANS for files required to run features # now set the script BOOLEANS for files required to run features
@ -8913,7 +8915,8 @@ calculate_line_length()
{ {
local string=$1 local string=$1
# ansi:  irc: \x0312 # ansi:  irc: \x0312
string=$( sed -e "s/\x1b\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g" -e "s/\\\x0[0-9]\{1,3\}//g" <<< $string ) # note: using special trick for bsd sed, tr
string=$( sed -e 's/'$ESC'\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g' -e 's/\\\x0[0-9]\{1,3\}//g' <<< $string )
count=${#string} count=${#string}
echo $count echo $count
} }

View file

@ -1,3 +1,21 @@
=====================================================================================
Version: 2.1.16
Patch Version: 00
Script Date: 2014-04-02
-----------------------------------
Changes:
-----------------------------------
New version, tarball. This fix only impacts bsd sed, but it fixes the line length failure
issue because bsd sed doesn't work with \x1b, but it does when you do:
ESC=$(echo | tr '\n' '\033' )
I found this trick on:
http://unix.stackexchange.com/questions/42321/how-can-i-instruct-bsd-sed-to-interpret-escape-sequences-like-n-and-t
No other changes. Non bsd users, you can ignore this.
-----------------------------------
-- Harald Hope - Wed, 02 Apr 2014 21:24:52 -0700
===================================================================================== =====================================================================================
Version: 2.1.15 Version: 2.1.15
Patch Version: 00 Patch Version: 00