bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inconsistent results when history -s is used within PROMPT_COMMAND


From: DennisW
Subject: Re: Inconsistent results when history -s is used within PROMPT_COMMAND
Date: Fri, 12 Jun 2009 16:15:19 -0700 (PDT)
User-agent: G2/1.0

Wow, that got really mangled somewhere! Here's the main part of the
test script again. Hopefully it'll come through OK this time.


histt() {
local space=''
space="${1:+ }" # set space to a space of there's a $1

    local hist
    local comment

    hist=$(history 1)
    hist="${hist# *[0-9]*  }"

    echo "....before...."
    history 3

    comment="some comment"
    history -s "$space$hist # $comment"

    echo "....after...."
    history 3

    PROMPT_COMMAND=$previous_prompt_command # put things back like you
found them
    unset previous_prompt_command
    unset histt
}
previous_prompt_command=$PROMPT_COMMAND
PROMPT_COMMAND="histt $1" # set up and run it


reply via email to

[Prev in Thread] Current Thread [Next in Thread]