Skip to content

Allow PROMPT_COMMAND to invoke a function #32

@chmaynard

Description

@chmaynard

I'd like to do the following in .bashrc:

log_on_success() {
	if [ $? -eq 0 ]
	then
        log-recent -r $? -c "$(HISTTIMEFORMAT= history 1)" -p $$
    fi
}

export PROMPT_COMMAND='log_on_success'

When I invoke the recent command, I get this error:

$ recent -h
PROMPT_COMMAND env variable is not set. Add the following line to .bashrc or .bash_profile
export PROMPT_COMMAND='log-recent -r $? -c "$(HISTTIMEFORMAT= history 1)" -p $$' 

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions