1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

openocd.sh: handle 'newline' on osx

https://stackoverflow.com/a/24276470

    In replacement strings used with the s command, assume that NO
    control-character escape sequences are supported (ex '\n')

Replace with an escaped newline character. Current form works in 'bash'.
This commit is contained in:
cladmi 2018-10-15 16:56:16 +02:00 committed by Gaëtan Harter
parent 6f02568c84
commit a7779e24c5
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B

View File

@ -172,9 +172,12 @@ _split_banks() {
# The following command needs specific osx handling (non gnu):
# * Same commands for a pattern should be on different lines
# * Cannot use '\n' in the replacement string
local sed_escaped_newline=\\$'\n'
sed -n '
/^{.*}$/ {
s/\} /\}\n/g
s/\} /\}'"${sed_escaped_newline}"'/g
s/[{}]//g
p
}'