summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-10-07 17:29:58 -0400
committerColin Walters <walters@verbum.org>2010-10-07 17:29:58 -0400
commitd25d4e252323629032e6c0f6b15a3864d266b8df (patch)
treea31b7fbcef71c0ab35bb9b2992441c267be53f6e
parent1db82a709adfd374aa9707fa4f89b708cddee8ea (diff)
downloadhomegit-MOVED-TO-GNOME-d25d4e252323629032e6c0f6b15a3864d266b8df.zip
homegit-MOVED-TO-GNOME-d25d4e252323629032e6c0f6b15a3864d266b8df.tar.gz
homegit-MOVED-TO-GNOME-d25d4e252323629032e6c0f6b15a3864d266b8df.tar.xz
bashrc: Quote variables
Otherwise we blow up if the cwd contains shell metacharacters.
-rw-r--r--dotfiles/bashrc16
1 files changed, 8 insertions, 8 deletions
diff --git a/dotfiles/bashrc b/dotfiles/bashrc
index c94bd5d..04e8d39 100644
--- a/dotfiles/bashrc
+++ b/dotfiles/bashrc
@@ -19,19 +19,19 @@ export EDITOR
_format_wd ()
{
pwd=$(pwd)
- base=$(basename $pwd)
- parent=$(basename $(dirname $pwd))
- pparent=$(basename $(dirname $parent))
- if test $pparent != "/"; then
+ base=$(basename "$pwd")
+ parent=$(basename $(dirname "$pwd"))
+ pparent=$(basename $(dirname "$parent"))
+ if test "$pparent" != "/"; then
echo -n "$parent/";
- echo -n $base;
+ echo -n "$base";
else
- if test $parent != "/"; then
+ if test "$parent" != "/"; then
echo -n "/$parent/"
- echo -n $base;
+ echo -n "$base";
else
echo -n "/";
- echo -n $base;
+ echo -n "$base";
fi
fi
}