aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Evan Jones <ej@evanjones.ca>2012-06-17 07:06:06 -0400
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-06-17 15:01:04 -0700
commit1fa0c4d4d3ea5de180c3f64aa00c478c90f04904 (patch)
treefc7e18ec77502cf7822b58ed03a0c1e80dff51df /share
parenteebe12684275b11f8b284ba9dd1a69b865855106 (diff)
alias: Support seds that don't support \n in replacements.
This makes the alias command work on Mac OS X.
Diffstat (limited to 'share')
-rw-r--r--share/functions/alias.fish6
1 files changed, 5 insertions, 1 deletions
diff --git a/share/functions/alias.fish b/share/functions/alias.fish
index cc5dab98..25eec3ea 100644
--- a/share/functions/alias.fish
+++ b/share/functions/alias.fish
@@ -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."
return 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 body $tmp[2]