mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
alias: Support seds that don't support \n in replacements.
This makes the alias command work on Mac OS X.
This commit is contained in:
parent
eebe126842
commit
1fa0c4d4d3
1 changed files with 5 additions and 1 deletions
|
@ -17,7 +17,11 @@ function alias --description "Legacy function for creating shellscript functions
|
||||||
echo "Fish implements aliases using functions. Use 'functions' builtin to see list of functions and 'functions function_name' to see function definition, type 'help alias' for more information."
|
echo "Fish implements aliases using functions. Use 'functions' builtin to see list of functions and 'functions function_name' to see function definition, type 'help alias' for more information."
|
||||||
return 1
|
return 1
|
||||||
case 1
|
case 1
|
||||||
set -l tmp (echo $argv|sed -e "s/\([^=]\)=/\1\n/")
|
# Some seds (e.g. on Mac OS X), don't support \n in the RHS
|
||||||
|
# Use a literal newline instead
|
||||||
|
# http://sed.sourceforge.net/sedfaq4.html#s4.1
|
||||||
|
set -l tmp (echo $argv|sed -e "s/\([^=]\)=/\1\\
|
||||||
|
/")
|
||||||
set name $tmp[1]
|
set name $tmp[1]
|
||||||
set body $tmp[2]
|
set body $tmp[2]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue