Opened 14 years ago
Last modified 10 years ago
#1369 closed defect
setPrompt: command not found in GRASS7-svn — at Version 2
Reported by: | moovida | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.0 |
Component: | Startup | Version: | svn-trunk |
Keywords: | shell, prompt | Cc: | |
CPU: | Unspecified | Platform: | Linux |
Description (last modified by )
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)"
Change History (2)
comment:1 by , 14 years ago
Milestone: | → 7.0.0 |
---|
comment:2 by , 14 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.