| ▲ | bh0k4l 4 days ago | |
How I use the script command to read the output of the last command and ask an LLM for help: The following custom command is executed for starting the terminal
The date sub-command creates a unique filename for the current session and stores it in SCRIPT_LOG_FILE_NAME.
Create a folder in /tmp/script-log/.
Script then writes the current terminal session to that file.
Now any command run in this terminal knows where the last program wrote its output.We can split the log at the last $PS1 prompt and feed the most recent chunk to a utility such as Simon W.'s llm. Add the following to .zshrc (or …):
Essentially, run a command; if it fails, run z. | ||
| ▲ | bmacho 4 days ago | parent [-] | |
On HN you can have a code block by adding 2 spaces before each line | ||