Re:PowerShell is open sourced and is available on Linux
by pm215 on Thursday August 18, 2016 @11:56AM
(#12313500)
You can use control-O for that, which does "execute this command as if I pressed enter, then when it's done bring up the following command in command line prompt". So if you have a set of commands to run that are 20 lines up in history, you can first find them (with 20x UP or by reverse-search), then just control-O control-O control-O control-O ... to execute them one after another.
[ Parent
| on HN ]
Re:PowerShell is open sourced and is available on Linux
by npsimons on Thursday August 18, 2016 @12:55PM
(#12314175)
Don't forget control-R. I find that even the GP's example of up arrow 20x to be ridiculous when I can type C-r and a few unique letters that were anywhere in the command to find it instantly.
Re:PowerShell is open sourced and is available on Linux
by stinos on Thursday August 18, 2016 @02:03PM
(#12314901)
Which is why any sane powershell user would probably have installed PsReadline to get this and other goodies. Preferably running in ConEmu.
Re:PowerShell is open sourced and is available on Linux
by iso-8859-1 on Friday August 19, 2016 @07:37AM
(#12319323)
PsReadline is shipped with PowerShell 5: https://technet.microsoft.com/en-us/library/ed48e832-95f9-45...
Re:PowerShell is open sourced and is available on Linux
by petepete on Thursday August 18, 2016 @12:01PM
(#12313556)
I wasn't aware of this. Thank you.
Not that I've been using Bash and zsh every day for twelve plus years...
Re:PowerShell is open sourced and is available on Linux
by mikestew on Thursday August 18, 2016 @12:09PM
(#12313663)
Twelve? Youngster. I'd guess I'm coming up on thirty years. And I did not know this.
Now the trick is to remember it next time the need comes up. :-)
Re:PowerShell is open sourced and is available on Linux
by verbify on Thursday August 18, 2016 @12:20PM
(#12313795)
Seems to be an instance of Cunningham's Law:
Re:PowerShell is open sourced and is available on Linux
by tbrock on Thursday August 18, 2016 @12:18PM
(#12313773)
Oh. My. God.
Life changing!
Out of curiosity, how did you discover that you could do this?
Re:PowerShell is open sourced and is available on Linux
by mrb on Thursday August 18, 2016 @02:08PM
(#12314946)
I am not the GP but I learned about C-o by reading the man page. If you spend a lot of time in Bash, why not learn to use it properly? There are less than ~100 key bindings, see "Readline Command Names" in http://linux.die.net/man/1/bash You should at the very least skim over them.
operate-and-get-next (C-o)
Accept the current line for execution and fetch the next line relative to the current line from the history for editing. Any argument is ignored.
Re:PowerShell is open sourced and is available on Linux
by pm215 on Thursday August 18, 2016 @12:25PM
(#12313871)
It's been something I've used for many years, so I really don't recall any more just where I found out about it...
Re:PowerShell is open sourced and is available on Linux
by riboflava on Thursday August 18, 2016 @02:14PM
(#12315000)
Maybe it went something like "god damn it why can't I ctrl+v to copy, what other ctrl keys are there..."? And now I'm looking at http://ss64.com/bash/syntax-keyboard.html and being amazed I didn't know about / forgot a few of these. It'd be nice to put some of the good ones on a coffee mug, I first learned useful vim commands from a coffee mug...
Re:PowerShell is open sourced and is available on Linux
by pm215 on Thursday August 18, 2016 @02:37PM
(#12315191)
Nope, because I've never used control-keystrokes to do cut-n-paste. I always use (and love) X-style mouse cut-n-paste and hate that there are no good implementations of it on other OSes.
Re:PowerShell is open sourced and is available on Linux
by fnj on Thursday August 18, 2016 @11:12PM
(#12317757)
Dating myself, the way I learned copy and paste was CTRL-insert and SHIFT-insert, and those still work fine in konsole, mate-terminal, most any other half-decent terminal program, and straight text mode outside of X.
Not xterm, but I never use that.
Re:PowerShell is open sourced and is available on Linux
by Datsundere on Thursday August 18, 2016 @04:34PM
(#12316129)
are you serious? you guys need to learn more shortcuts. http://teohm.com/blog/shortcuts-to-move-faster-in-bash-comma...
Re:PowerShell is open sourced and is available on Linux
by titanomachy on Thursday August 18, 2016 @02:04PM
(#12314906)
Doesn't work in bash running in my Terminal.app on macOS, although it certainly does when I `ssh` into one of my Ubuntu boxes. Wonderful shortcut.
EDIT: If anyone knows an easy way to get this working on macOS, I'd love to know it.
Re:PowerShell is open sourced and is available on Linux
by pm215 on Thursday August 18, 2016 @02:45PM
(#12315257)
Stackoverflow to the rescue:
http://apple.stackexchange.com/questions/3253/ctrl-o-behavio...
This turns out to be because on OSX the terminal driver defaults to throwing away control-O which is rather unhelpful of it. "stty discard undef" fixes it.