From 5ecd0e22bf6d4388b18de1e828b16c3853b3adc5 Mon Sep 17 00:00:00 2001 From: liljencrantz Date: Sun, 23 Sep 2007 05:07:34 +1000 Subject: [PATCH] Remove a few calls to the test command in favour of the switch builtin to speed statup up darcs-hash:20070922190734-75c98-0e63a0ed6685edc2c9aa941f0b26c14466c7af6a.gz --- share/functions/__fish_config_interactive.fish | 6 +++++- share/functions/pwd.fish | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 7688ef9c5..6e100fdc1 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -83,7 +83,11 @@ function __fish_config_interactive -d "Initializations that should be performed set -U fish_greeting $line1\n$line2 end - if test "$fish_greeting" + switch $fish_greeting + case '' + # If variable is empty, don't print anything, saves us a fork + + case '*' echo $fish_greeting end diff --git a/share/functions/pwd.fish b/share/functions/pwd.fish index 6d1c3f58a..d51fe5c61 100644 --- a/share/functions/pwd.fish +++ b/share/functions/pwd.fish @@ -3,12 +3,16 @@ # Also drop '/private' directories on OS X. # -if test (uname) = Darwin +switch (uname) + + case Darwin function pwd --description "Print working directory" echo $PWD | sed -e 's|/private||' -e "s|^$HOME|~|" end -else + + case '*' function pwd --description "Print working directory" echo $PWD | sed -e "s|^$HOME|~|" end + end \ No newline at end of file