Timeline for Echoing stdin when running an ed(1) script
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 27, 2019 at 10:16 | comment | added | roblogic | @mikeserv, +1 for being a mad genius :P | |
| Mar 18, 2015 at 3:14 | comment | added | mikeserv |
@don_crissti - I would think maybe dd could be used to limit bytes per write... I once did something where I made a shell kill -PIPE $$ itself for every iteration of a loop with a trap where it would consistently exec 3>&1 >&-; exec >&3 so it would keep reopening the pipe for every write. I never made anything useful of it, because I was never able to figure out for sure why it worked - was it the kill ... trap stuff or was it the exec ... stuff? Or both? I still don't know, and so I'm not sure how your thing works. I wish I could upvote it again, though.
|
|
| Mar 18, 2015 at 2:48 | comment | added | mikeserv | @don_crissti - I'm playing around with it - and it's pretty cool - but I don't understand how it works. | |
| Mar 18, 2015 at 2:37 | comment | added | mikeserv |
@don_crissti - are you using that e to do complete writes? Because when the shell it runs up and kills immediately opens() and closes() its output on that pipe it should look like a write to the pipe, right?
|
|
| Mar 18, 2015 at 2:32 | comment | added | mikeserv |
@don_crissti - what's it doing there? s/.*//e? It seems... weird. Pretty much though if you just use w /dev/fd/2 you've moved from relying on a single sed implementation to a system that supports /dev/fd/[num] links. They tend to be a little more portable by number. Also fun is 4<<SED\n$(sed '... w /dev/fd/4' >/dev/null 2>&1\nSED\n
|
|
| Jan 3, 2015 at 10:24 | history | edited | mikeserv | CC BY-SA 3.0 |
deleted 10 characters in body
|
| Jan 3, 2015 at 5:41 | history | edited | mikeserv | CC BY-SA 3.0 |
deleted 17 characters in body
|
| Jan 3, 2015 at 5:20 | comment | added | mikeserv | @don_crissti - I pretty much rewrote it, I guess. It's here now if you wanna play around with it. | |
| Jan 3, 2015 at 5:16 | history | edited | mikeserv | CC BY-SA 3.0 |
added 544 characters in body
|
| Jan 2, 2015 at 16:06 | comment | added | mikeserv |
@don_crissti - oh, wait. I see why it breaks for those... I exchange at the end of the completed [aic] test and again after testing for ...\\\(\n.*\)*$ that exchange needs to change - I did it like that because I wanted to alternate correctly between hold pattern spaces depending on whether I had just gathered \\escaped input or [aic] input. In the former case the data I want at the end is in hold space when I'm through verifying it, but in the latter case it's in pattern space. I just need to rearrange that a little bit and the [aic] block won't test positive for \\\n.
|
|
| Jan 2, 2015 at 15:16 | comment | added | mikeserv |
@don_crissti - thanks Don. Hmmm... I thought I handled that by adding the /\n/!s/$/ \\/ part which is supposed to ensure that any line within one of those blocks never gets a doubled up \\ at the end. Or do I defeat my own purpose there? Now I forget... probably ezequiel makes a good point. This is just experimentation... I want to do a readline type of thing without readline - which does not at all suit my tastes - and I think vi/ex/ed are probably my best bets. Try stty raw isig onlret opost min 1 time 0; dd bs=8 conv=sync </dev/tty | sed -nzue /./l... Now to get that into ex...
|
|
| Jan 1, 2015 at 22:16 | comment | added | ezequiel-garzon | Wow! That looks hard to debug, let alone understand in my case... Moreover, the output is not quite what I described. Thanks for your input in any event! | |
| Dec 31, 2014 at 18:48 | history | answered | mikeserv | CC BY-SA 3.0 |