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

Only the first line of a multi-line command is recorded. #19

Open
shelvacu opened this issue Jun 10, 2021 · 1 comment
Open

Only the first line of a multi-line command is recorded. #19

shelvacu opened this issue Jun 10, 2021 · 1 comment

Comments

@shelvacu
Copy link

shelvacu commented Jun 10, 2021

Run a command like:

echo '1
2
3'

and ash will only record echo '1

This happens because read only reads the first line, see

read -r cmd_no start_ts cmd <<< "$( builtin history 1 )"
read -r no start end cmd <<< "$( __ash_last_command )"
read -r cmd_no cmd <<< "$( builtin history -1 )"

I've only tested this in bash, but if zsh's read works the same then it will have the same bug.

@shelvacu
Copy link
Author

This could be somewhat mitigated in bash with shopt -u cmdhist, which will save each line as a separate command.

This could be solved by moving the 'parsing' code to C++/python and doing builtin history 1 | __ash_log --history-from-stdin or something

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

No branches or pull requests

1 participant