-
Notifications
You must be signed in to change notification settings - Fork 230
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
In bash, PREV=$(fc -lrn | head -n 1) doesn't retrieve the previous command #72
Comments
Found out ! If there's a pipeline, bash seems to add the current command to the history BEFORE running
To show it in action:
|
As a suggestion, I'd replace function
|
This is still not good. When I use tab completion to complete a command, and the add it to pet with
I type There's still some tweaking to do with this alias ... |
This will solve the problem:
|
Just discovered now that the problem with the trailing ** has nothing to do with autocompletion: if there are trailing spaces, they'll with be escaped by |
README.md suggests this function to add the last command to pet:
However, in bash
PREV=$(fc -lrn | head -n 1)
results in storing PREV=$(fc -lrn | head -n 1) inPREV
:To work correctly in bash, that line should be:
PREV=$(fc -ln -1)
as you can see now:
I'm struggling to get rid of the leading tab, piping the output to sed results in changing the history. If I find out a neat way of doing it, I will document it here.
The text was updated successfully, but these errors were encountered: