mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 15:05:27 +08:00
fix compatibility with BSD sed
This commit is contained in:
parent
2f67cb341c
commit
b8ba04dcf4
@ -57,9 +57,19 @@ function __fish_print_gpg2_algo -d "Complete using all algorithms of the type sp
|
||||
# goto loop
|
||||
# remove everything until the first ':' of the line
|
||||
# remove all blanks
|
||||
# transliterate ',' with '\n' (OSX apparently doesn't like '\n' on RHS of the s-command)
|
||||
# transliterate ',' with '\n' (macOS apparently doesn't like '\n' on RHS of the s-command)
|
||||
# print result
|
||||
gpg2 --version | sed -ne "/$argv:/"'{:loop; /,$/{N; y!\n! !; b loop}; s!^[^:]*:!!; s![ ]*!!g; y!,!\n!; p}'
|
||||
# sed script must be formatted with newlines instead of semicolons to be compatible
|
||||
# with BSD sed (eg, on macOS)
|
||||
gpg2 --version | sed -ne "/$argv:/"'{:loop
|
||||
/,$/{N; y!\n! !
|
||||
b loop
|
||||
}
|
||||
s!^[^:]*:!!
|
||||
s![ ]*!!g
|
||||
y!,!\n!
|
||||
p
|
||||
}'
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user