8d2b9d10e5105f9e0af0700e427e0567011ab45b

Author
Suraj N. Kurapati <sunaku@gmail.com>
Committer
Suraj N. Kurapati <sunaku@gmail.com>
Date

Message

avoid forking subshell to test if user is root

Diff

 1diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme
 2index b5a9bb1730da771dd6cc253e1676e3382285b808..3a4753fc105f01c21e30d7886f887360cec74da7 100644
 3--- a/themes/afowler.zsh-theme
 4+++ b/themes/afowler.zsh-theme
 5@@ -1,4 +1,4 @@
 6-if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
 7+if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
 8 
 9 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
10 
11diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme
12index a23efd1d763e3f4fca4f488f7286958c76d0fe07..d62dcdcb9d7fc8cdb47206675dc9250d8efe6c96 100644
13--- a/themes/arrow.zsh-theme
14+++ b/themes/arrow.zsh-theme
15@@ -1,4 +1,4 @@
16-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
17+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
18 
19 PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}'
20 RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}'
21diff --git a/themes/clean.zsh-theme b/themes/clean.zsh-theme
22index 95f532a823f589722c35fe95e6ae282126b69d16..7ee29cb8ccea928eb93da029ba95b14fc18c4ffc 100644
23--- a/themes/clean.zsh-theme
24+++ b/themes/clean.zsh-theme
25@@ -1,4 +1,4 @@
26-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi
27+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi
28 
29 PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
30 RPROMPT='[%*]'
31diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme
32index fa0d9cb06bf605df6a54f3db163e52e9c6e31176..3e2539d57592937a074e0c01e68bd76cf0d539d2 100644
33--- a/themes/dst.zsh-theme
34+++ b/themes/dst.zsh-theme
35@@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
36 ZSH_THEME_GIT_PROMPT_CLEAN=""
37 
38 function prompt_char {
39-	if [ "$(whoami)" = "root" ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
40+	if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
41 }
42 
43 PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
44diff --git a/themes/jreese.zsh-theme b/themes/jreese.zsh-theme
45index 534664f115e4c8b5bcd3af8eb360362ea6de6b6b..0fa6b4ecd5e85596e80e7cc1dd1894878aa0f7ac 100644
46--- a/themes/jreese.zsh-theme
47+++ b/themes/jreese.zsh-theme
48@@ -1,6 +1,6 @@
49 # ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png
50 
51-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
52+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
53 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
54 
55 PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \
56diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme
57index fa7c590355a2a1fcd8b7c4d87ad19e9f234be2eb..e7ea51a2ff8202536a24790780064ecf0d6ade7f 100644
58--- a/themes/philips.zsh-theme
59+++ b/themes/philips.zsh-theme
60@@ -1,4 +1,4 @@
61-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
62+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
63 
64 PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
65 RPROMPT='[%*]'
66diff --git a/themes/pmcgee.zsh-theme b/themes/pmcgee.zsh-theme
67index 4eb54df5baaf5922c19a801882359de3f737ef27..e4e45c71adfa23054eca9eb3daadda8856b6874c 100644
68--- a/themes/pmcgee.zsh-theme
69+++ b/themes/pmcgee.zsh-theme
70@@ -1,4 +1,4 @@
71-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
72+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
73 
74 PROMPT='
75 %{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%}