Skip to content

Commit fbf2aac

Browse files
committed
Fix some bash bugs
1 parent 67b26df commit fbf2aac

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

profile.org

+36-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ a shell-slut, and dabble between Zshell and Fish.
2121
if [ ! -d /usr/local/Cellar -a -n "$ON_A_MAC" ]
2222
then
2323
echo "ZOMG! No Homebrew installed! Installing now..."
24-
ruby -e "`curl -fsSL https://raw.github.com/mxcl/homebrew/go/install`"
24+
echo 'ruby -e "`curl -fsSL https://raw.github.com/mxcl/homebrew/go/install`"'
2525
fi
2626
#+END_SRC
2727

@@ -57,11 +57,21 @@ a shell-slut, and dabble between Zshell and Fish.
5757

5858
* Global Aliases
5959

60-
I dislike =more=, especially since =less= is now really sweet.
60+
Just standard things that I keep typing:
6161

62-
#+BEGIN_SRC shell
63-
alias more=less
64-
#+END_SRC
62+
#+BEGIN_SRC shell
63+
alias e='emacsclient -nw'
64+
alias ee='emacsclient'
65+
alias gst='git status'
66+
67+
if type gls >/dev/null 2>&1
68+
then
69+
alias ls='gls --color'
70+
alias ll='gls -al --color'
71+
else
72+
alias ll='ls -al'
73+
fi
74+
#+END_SRC
6575

6676
* Python
6777

@@ -203,6 +213,19 @@ a shell-slut, and dabble between Zshell and Fish.
203213
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
204214
#+END_SRC
205215

216+
* Completions
217+
218+
Assuming the location of all the Bash completions:
219+
220+
#+BEGIN_SRC shell
221+
source /usr/local/etc/bash_completion.d/brew
222+
# source /usr/local/etc/bash_completion.d/coreutils
223+
# source /usr/local/etc/bash_completion.d/findutils
224+
source /usr/local/etc/bash_completion.d/git-prompt.sh
225+
source /usr/local/etc/bash_completion.d/git-completion.bash
226+
# source /usr/local/etc/bash_completion.d/ssh
227+
#+END_SRC
228+
206229
* Prompt
207230

208231
A helper function to help trim down lengthy directories:
@@ -223,6 +246,7 @@ a shell-slut, and dabble between Zshell and Fish.
223246
__git_ps1 " :%s" | sed 's|^ :review/.*/\([0-9]*\)$| :review-\1|'
224247
}
225248
#+END_SRC
249+
226250
Better approach to displaying the current path, is to only display
227251
the first or second directory name ... any maybe the name of the Git
228252
project. Holy hell, so many exceptions and so few patterns...
@@ -250,12 +274,12 @@ a shell-slut, and dabble between Zshell and Fish.
250274
then
251275
name=$(sed -E "s|$HOME/Work/([[:alnum:]_-]+).*|\1|; s/ / /g" <<< $PWD)
252276
base=$(basename $PWD)
253-
intr=$(basename `dirname $PWD`)
277+
intr=$(basename "`dirname \"$PWD\"`")
254278

255-
if [[ $name == $base ]]
279+
if [[ "$name" == "$base" ]]
256280
then
257281
echo -n "Ⓦ/$name"
258-
elif [[ $intr == $name ]]
282+
elif [[ "$intr" == "$name" ]]
259283
then
260284
echo -n "Ⓦ/$name/$base"
261285
else
@@ -265,9 +289,11 @@ a shell-slut, and dabble between Zshell and Fish.
265289
# In a home directory
266290
elif [[ $PWD == $HOME/* ]]
267291
then
268-
if [[ $(basename `dirname $PWD`) == $(basename $HOME) ]]
292+
base=$(basename $PWD)
293+
intr=$(basename "`dirname \"$PWD\"`")
294+
if [[ "$intr" == $(basename $HOME) ]]
269295
then
270-
echo -n "~/$(basename $PWD)"
296+
echo -n "~/$base"
271297
else
272298
echo -n "~/$(_trim_dir $PWD)"
273299
fi

0 commit comments

Comments
 (0)