Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/history/fc #53

Closed
wants to merge 1 commit into from
Closed

s/history/fc #53

wants to merge 1 commit into from

Conversation

jombooth
Copy link
Contributor

Replace 'history' with 'fc', since the latter is designed to be machine-parsable; this way there's no need to adjust HISTTIMEFORMAT.

@jombooth
Copy link
Contributor Author

@rcaloras - ping!

@rcaloras
Copy link
Owner

@jombooth I'm getting the previous command passed to preexec here not the command I'm trying to execute:

[rcaloras:~/git/bash-preexec] jombooth-fc ± preexec() { echo "about to execute: $1"; }
[rcaloras:~/git/bash-preexec] jombooth-fc ± echo "1"
about to execute: preexec() { echo "about to execute: $1"; }
1
[rcaloras:~/git/bash-preexec] jombooth-fc ± echo "2"
about to execute: echo "1"
2
[rcaloras:~/git/bash-preexec] jombooth-fc ± echo "3"
about to execute: echo "2"
3

Copy link
Owner

@rcaloras rcaloras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the example. Tried against master and it works fine.

@jombooth
Copy link
Contributor Author

jombooth commented Sep 28, 2017

Just found time to test this out on my machine; the example seems to work as expected -

jo@computer: $ . bash-preexec.sh
jo@computer: $ preexec() { echo "about to execute: $1"; }
jo@computer: $ echo "1"
about to execute: echo "1"
1
jo@computer: $ echo "2"
about to execute: echo "2"
2

Can you test this again?

@rcaloras
Copy link
Owner

rcaloras commented Oct 1, 2017

Was just able to recreate. I'm getting this error specifically on my macbook. Works fine on my linux environment. Maybe something in regards to the bash version?

[rcaloras:~] $ uname -a
Darwin rcaloras-mbp 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
[rcaloras:~] $ echo $BASH_VERSION
3.2.57(1)-release

@jombooth
Copy link
Contributor Author

jombooth commented Oct 1, 2017

Hmm, I suppose I've only run this on Bash 4. Out of curiosity, what's the output of

fc -l -0

on your Mac? On mine I get the current command:

jo@computer: $ fc -l -0
1076 fc -l -0

@rcaloras
Copy link
Owner

rcaloras commented Oct 1, 2017

Looks like it's the previous command. Opening a new terminal window and testing:

[rcaloras:~] $ fc -l -0
500	 exit
[rcaloras:~] $ fc -l -0
501	 fc -l -0

@jombooth
Copy link
Contributor Author

jombooth commented Nov 3, 2017

Withdrawing this PR as inconsistent "fc" behavior messes it up. Alas...

@jombooth jombooth closed this Nov 3, 2017
@jombooth jombooth deleted the fc branch November 3, 2017 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants