[GRASS-dev] [GRASS GIS] #1369: setPrompt: command not found in
GRASS7-svn
GRASS GIS
trac at osgeo.org
Sun May 22 08:20:55 EDT 2011
#1369: setPrompt: command not found in GRASS7-svn
-------------------------+--------------------------------------------------
Reporter: moovida | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone:
Component: Startup | Version: svn-trunk
Keywords: | Platform: Linux
Cpu: Unspecified |
-------------------------+--------------------------------------------------
The grass7 command shell doesn't appear to permit to have an own
setPrompt.
I use a customized one to have some different information/coloring of the
prompt in the case of git and hg repos:
function setPrompt(){
thedate=`date "+%F %T"`
if [ -d ./.git ]; then
GITBRANCH="$NC($GREEN$(awk -F '/' '{ print $NF }' .git/HEAD)$NC"
if [ $(git diff --exit-code > /dev/null 2>&1; echo $?) -eq 1 ] ||
[ $(git diff-index --cached --quiet --ignore-submodules HEAD --; echo $?)
-eq 1 ]; then
GITBRANCH="$GITBRANCH [$RED*$NC"
else
GITBRANCH="$GITBRANCH [$MAGENTA-$NC"
fi
if [ "x$(git status | grep Untracked)" != "x" ]; then
GITBRANCH="$GITBRANCH$RED+$NC])"
else
GITBRANCH="$GITBRANCH$MAGENTA-$NC])"
fi
echo -e "\n${GREEN}GIT:${NC} ${GITBRANCH}"
echo -e
"${GREEN}======================================================
$thedate${NC}\n\n\w >>> "
elif [ -d ./.hg ]; then
HGBRANCH="$NC($CYAN$(awk -F '/' '{ print $NF }' .hg/branch)$NC"
if [ "x`hg status | grep ?`" != "x" ]; then
HGBRANCH="$HGBRANCH [$RED+$NC])"
else
HGBRANCH="$HGBRANCH [$MAGENTA-$NC])"
fi
echo -e "\n${CYAN}HG:${NC} ${HGBRANCH}"
echo -e
"${CYAN}======================================================
$thedate${NC}\n\n\w >>> "
else
echo -e
"${RED}======================================================
$thedate${NC}\n\n\w >>> "
fi
}
which leads me to the error in the subject.
While for example in grass64 I have:
GRASS 6.4.0+42329 (gbovest):~ > echo $PROMPT_COMMAND
'/usr/lib/grass64/etc/prompt.sh'
in grass7 it seems to have changed to:
echo $PROMPT_COMMAND
PS1="$(setPrompt)"
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1369>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list