문제

hey guys I'm having an issue passing a exit code from my ~/.bashrc file into another script continually (as in, a new code each time a command is executed). I currently have the following

.bashrc

generateFlag() 
{
    local flag="$?" ; PS1=''
}
PROMPT_COMMAND=generateFlag

. ~/.scipts/prompt.sh $flag

My prompt script is pretty much this

echo $1

Anyone know a way to get this working??

도움이 되었습니까?

해결책

.bashrc :

# some code before
export FLAG=$?

exec script :

~/.scripts/prompt.sh $FLAG
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top