~ecs/dotfiles

d4680822c2369b0bcff90253107519f96c746f4d — Eyal Sawady 29 days ago 7cc8e3a
prompt: append "#" on root shells
1 files changed, 1 insertions(+), 1 deletions(-)

M bin/prompt
M bin/prompt => bin/prompt +1 -1
@@ 1,2 1,2 @@
#!/bin/sh -eu
T="$(mktemp)";git status --porcelain -b 2>/dev/null>"$T"||true;i(){ grep -q "${1%??}" <"$T"&&printf %s "${1#*:}"||true;};w="$(pwd|sed -e"s%^$HOME%~%" -e's:^/[^/]\+$::' -e's:/\(.\)[^/]*:\1:g' -e's:\(.\).$:\1/:')$(pwd|sed -e"s%^$HOME%%" -e's:.*/::')$(i ^.M:!;i ^.D:\`;i ^D.:\';i ^A.:+;i '^M.:*';i ^R.:=;i '^U.:<';i '^.U:>';i ^??:%;i '^##.*ahead [0-9]*.$:^')";printf %s "${SSH_CONNECTION:+$textc$(uname -n)}$pwdc$w$textc";printf '\e]2;%s\a' "${SSH_CONNECTION:+$(uname -n) }$w"; exec rm "$T"
T="$(mktemp)";git status --porcelain -b 2>/dev/null>"$T"||true;i(){ grep -q "${1%??}" <"$T"&&printf %s "${1#*:}"||true;};s="${SSH_CONNECTION:+$(uname -n)}";w="$(pwd|sed -e"s%^$HOME%~%" -e's:^/[^/]\+$::' -e's:/\(.\)[^/]*:\1:g' -e's:\(.\).$:\1/:')$(pwd|sed -e"s%^$HOME%%" -e's:.*/::')$(i ^.M:!;i ^.D:\`;i ^D.:\';i ^A.:+;i '^M.:*';i ^R.:=;i '^U.:<';i '^.U:>';i ^??:%;i '^##.*ahead [0-9]*.$:^')$([ $(id -u) == 0 ]&&printf \#||true)";printf %s "$textc$s$pwdc$w$textc";printf '\e]2;%s\a' "$s$w"; exec rm "$T"