From 56e9e243a3d9b86deb16d7af7f0136d1cd55c962 Mon Sep 17 00:00:00 2001 From: Martin Goldhahn Date: Wed, 3 Jul 2013 01:53:22 +0200 Subject: [PATCH 1/2] script works for any installation directory --- gitprompt.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gitprompt.sh b/gitprompt.sh index 84791fa..94843a6 100644 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -1,6 +1,14 @@ -if [ "x$__GIT_PROMPT_DIR" == "x" ] -then - __GIT_PROMPT_DIR=~/.bash +#!/bin/bash +# assume the gitstatus.py is in the same directory as this script +# code thanks to http://stackoverflow.com/questions/59895 +if [ -z "$__GIT_PROMPT_DIR" ] ; then + SOURCE="${BASH_SOURCE[0]}" + while [ -h "$SOURCE" ] ; do + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + done + __GIT_PROMPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" fi # Colors From f36da50f680f8f7e200acc272561f5fec5cd9dfd Mon Sep 17 00:00:00 2001 From: Martin Goldhahn Date: Wed, 3 Jul 2013 02:16:42 +0200 Subject: [PATCH 2/2] use 24h time format --- gitprompt.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitprompt.sh b/gitprompt.sh index 94843a6..a49f784 100644 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -31,7 +31,8 @@ IBlack="\[\033[0;90m\]" # Black Magenta="\[\033[1;95m\]" # Purple # Various variables you might want for your PS1 prompt instead -Time12a="\@" +#Time12a="\@" +Time12a="(\$(date +%H:%M:%S))" PathShort="\w" # Default values for the appearance of the prompt. Configure at will.