Commit 3b7c0a3f authored by Charles Ferguson's avatar Charles Ferguson
Browse files

More updates to fix use of sed, this time on linux.

The {} usage on OSX appears to work just fine, but on Linux, it
reports that the values in the braces are badly formed. This time I
think it's the GNU tool that's right, and escaping the braces seems
to fix the issue.

Additionally we handle the escaping of the replaced strings a little
better.
parent dc648b89
...@@ -554,17 +554,21 @@ function _perllib_setup ...@@ -554,17 +554,21 @@ function _perllib_setup
end end
if [ "$var" = 'PATH' ] if [ "$var" = 'PATH' ]
# The path variable needs to have the colons translated to spaces,
# and the path parameters as a whole un-quoted, as the PATH is
# an array in fish.
eval (sed -E '/^(export )?'$var'=/ ! d; eval (sed -E '/^(export )?'$var'=/ ! d;
s/export '$var';//g; s/export '$var';//g;
s/^(export )?'$var'="(.*)";?/set -gx "'$var'" \2/; s/^(export )?'$var'="(.*)";?/set -gx "'$var'" \2/;
s/\${'$var':\+:\${'$var'}}/'":\$$var"'/; s/\$\{'$var':\+:\$\{'$var'\}\}/'":\$$var"'/;
s/:/ /g' "$tmpfile") s/:/ /g;' "$tmpfile")
else else
# Non-PATH variables only need to be translated to the format
# with quotes around the string, and colons retained.
eval (sed -E '/^(export )?'$var'=/ ! d; eval (sed -E '/^(export )?'$var'=/ ! d;
s/export '$var';//g; s/export '$var';//g;
s/^(export )?'$var'="(.*)";?/set -gx "'$var'" "\2"/; s/^(export )?'$var'="(.*)";?/set -gx "'$var'" "\2"/;
s/\${'$var':\+:\${'$var'}}/'":\$$var"'/; s/\$\{'$var':\+:\$\{'$var'\}\}/'":\$$var"'/;' "$tmpfile")
s/:/ /g' "$tmpfile")
end end
end end
rm -f "$tmpfile" rm -f "$tmpfile"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment