Question: Is there a way to get the output of the last command?
Vasdranna opened this issue · 5 comments
Question
I know this might be a silly question, but, is there a way to achieve the following?
λ command1
# command1 output
λ <shortcut_or_command>
# command1 output
Where shortcut_or_command
would be what I'm looking for, a way to retrieve the last output (not the last exit code, just the last output).
I found a shortcut named "Show alternative console buffer (last command output)", but I don't know what it does.
Thanks!
Checklist
- I have read the documentation and made sure what I'm looking for isn't present, or is unclear.
- I have searched for similar issues, and either this question wasn't asked before, or I didn't find any that describe my question.
You mean like a command alias?
alias lsar=ls -lar
lsar
# ls -lar output
You mean like a command alias?
alias lsar=ls -lar
lsar # ls -lar output
Hi! Either way would be fine, because I don't know how it could be achieved.
What I'm looking for is a way for CMDER to resend its last output, be it with a command or a keyboard shortcut.
λ echo hey
hey
λ <command/shortcut to resend the last console output>
hey
What do you mean by "resend the last output"?
Resend it where, how? You can scroll up to view it, so you must be asking about something other than viewing the output that's on the screen.
Also, the output is from other console mode programs launched from inside ConEmu/Cmder. The output is not actually from ConEmu/Cmder.
(Or are you asking how to access command history and rerun a command? But the command may produce different output the next time, so that wouldn't "resend the last output".)
@Perverance is it possible to append something like: | tee last_output.txt
to the end of your command?
Then you can do cat last_output.txt
later to see the ouput again. You can bind this to a shortcut key using Clink, too.
Alternatively, we need a shell that would capture the output of every command that is run, the have something like show last output command to retireve it. A bit unfeasible, but perfectly doable nonetheless.
Alternatively, we need a shell that would capture the output of every command that is run, the have something like show last output command to retireve it. A bit unfeasible, but perfectly doable nonetheless.
A shell can't capture output without using redirection, and redirection alters how programs operate.
"Always-on output capture" is something that would have to be provided by the terminal itself, otherwise it would create compatibility problems in programs.