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

Question: Is there a way to get the output of the last command? #2950

Open
2 tasks done
Perverance opened this issue Jun 21, 2024 · 5 comments
Open
2 tasks done

Question: Is there a way to get the output of the last command? #2950

Perverance opened this issue Jun 21, 2024 · 5 comments

Comments

@Perverance
Copy link

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.
@daxgames
Copy link
Member

You mean like a command alias?

alias lsar=ls -lar

lsar
# ls -lar output

@Perverance
Copy link
Author

Perverance commented Jun 21, 2024

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

@chrisant996
Copy link
Contributor

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".)

@DRSDavidSoft
Copy link
Contributor

@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.

@chrisant996
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants