Hi kschwab
> Then, just run "rlwrap perl" instead of "perl", and it should do what you want.
Thanks, I knew rlwrap and it's already installed. :)
I erroneously thought that on Win I'm able to navigate the whole chunk of code from the last call to perl instead of just reconstruction line after line.
But it turns out I was wrong.
Probably there is an option for rlwrap to treat the whole chunk as one line. Have to look into it.
For me there is a gap to be filled between improvised one-liners and persistent scripts.
I also tried putting all into a bash heredoc but either my bash foo is too weak or interactive input is treating heredocs differently
$ perl -e <<___
if(1) {
print 44;
}
___
No code specified for -e.
EDIT:
But while composing this post I noticed that this syntax does what I want:
$ perl <<___
if(1) {
print 44;
}
___
44
# arrow up
$ perl <<___
if(1) {
print 44;
}
___
Of course on bash only :(
update
unfortunately the "solution" I found is messing up STDIN pipes
lanx@lanx-1005HA:/tmp$ ls |perl -n <<___
print if /a/
___
lanx@lanx-1005HA:/tmp$ ls |perl -ne '
print if /a/
'
atop.d
at-spi2
mkinitramfs_JrDw4Q
mkinitramfs-OL_Ahxk1r
|