Skip to content

Commit

Permalink
alias: Support seds that don't support \n in replacements.
Browse files Browse the repository at this point in the history
This makes the alias command work on Mac OS X.
  • Loading branch information
evanj authored and ridiculousfish committed Jun 17, 2012
1 parent eebe126 commit 1fa0c4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion share/functions/alias.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 1fa0c4d

Please sign in to comment.