Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Reduce forking overhead in precmd()



I have a precmd() that I would like to augment to include source
control freeze info (we use clearcase, a freeze will change the way
files are represented).

precmd ()
{
    ....

    if [[ $CLEARCASE_ROOT != "" ]]; then
        RPROMPT=${RPROMPT:s/"%S f %s "//}
        cleartool catcs | grep time > /dev/null
	if [[ $? == 0 ]]; then
	    RPROMPT="%S f %s %$RPROMPT"
	fi
    fi
}

Basically the "cleartool catcs" command is required, if its output
contain 'time', then there is a freeze condition which I will modify
the RPROMPT to include an indicator.

However, this still added 2 more forks per command and the response is
not that desirable.  Any way to speed this up, for example, is there
a way in zsh to replace the 'grep' above?

Thanks in advance.



Messages sorted by: Reverse Date, Date, Thread, Author