aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Evan Jones <ej@evanjones.ca>2012-06-17 07:17:05 -0400
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-06-17 15:01:04 -0700
commit01780f19b1ffda0026e44a116d27d887dbfb096e (patch)
tree0df02bbf15d5740cdf10db9e528f887266907e83 /share
parent1fa0c4d4d3ea5de180c3f64aa00c478c90f04904 (diff)
Fix other usages of \n in sed replacements.
Diffstat (limited to 'share')
-rw-r--r--share/functions/__fish_complete_command.fish6
-rw-r--r--share/functions/__fish_complete_lpr_option.fish6
-rw-r--r--share/functions/__fish_print_make_targets.fish6
3 files changed, 15 insertions, 3 deletions
diff --git a/share/functions/__fish_complete_command.fish b/share/functions/__fish_complete_command.fish
index 8dc1d311..983366db 100644
--- a/share/functions/__fish_complete_command.fish
+++ b/share/functions/__fish_complete_command.fish
@@ -2,7 +2,11 @@ function __fish_complete_command --description 'Complete using all available com
set -l ctoken (commandline -ct)
switch $ctoken
case '*=*'
- set ctoken (echo $ctoken | sed 's/=/\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 ctoken (echo $ctoken | sed 's/=/\\
+/')
printf '%s\n' $ctoken[1]=(complete -C$ctoken[2])
case '*'
complete -C$ctoken
diff --git a/share/functions/__fish_complete_lpr_option.fish b/share/functions/__fish_complete_lpr_option.fish
index 287b13eb..aa9d981f 100644
--- a/share/functions/__fish_complete_lpr_option.fish
+++ b/share/functions/__fish_complete_lpr_option.fish
@@ -5,7 +5,11 @@ function __fish_complete_lpr_option --description 'Complete lpr option'
set -l IFS =
echo $optstr | read -l opt val
set -l descr
- for l in (lpoptions -l ^ /dev/null | grep $opt | sed 's+\(.*\)/\(.*\):\s*\(.*\)$+\2 \3+; s/ /\n/g;')
+ # 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
+ for l in (lpoptions -l ^ /dev/null | grep $opt | sed 's+\(.*\)/\(.*\):\s*\(.*\)$+\2 \3+; s/ /\\
+/g;')
if not set -q descr[1]
set descr $l
continue
diff --git a/share/functions/__fish_print_make_targets.fish b/share/functions/__fish_print_make_targets.fish
index c57e8871..bda806f4 100644
--- a/share/functions/__fish_print_make_targets.fish
+++ b/share/functions/__fish_print_make_targets.fish
@@ -1,4 +1,8 @@
function __fish_print_make_targets
set files Makefile makefile GNUmakefile
- sgrep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\n/g' ^/dev/null
+ # 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
+ sgrep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\\
+/g' ^/dev/null
end