Skip to main content
26 events
when toggle format what by license comment
May 18, 2021 at 15:43 comment added ash @Cole there are word-level diff tools. It's been a while - maybe wdiff?
May 18, 2021 at 3:28 comment added Cole @ash Actually I lied, this appears to work with regular diff but not git diff I was hoping to use git diff --color-words for it's word level diff but it looks like I might be out of luck.
May 18, 2021 at 3:26 comment added Cole @ash Hmm, no dice for me (using bash). I get /tmp/sh-thd.{-larZPk-}{+gD04GI+} (deleted) I've also tried it with process substitution and got: pipe:[6255284{-2-}{+4+}]
May 17, 2021 at 21:19 comment added ash @Cole: Here, do this: diff /dev/fd/98 /dev/fd/99 98<<! 99<<! then follow with the two here-docs terminated by ! each
May 17, 2021 at 21:17 comment added ash That gets squashed when inlined.
May 17, 2021 at 21:16 comment added ash Tricky. You could do something like this: exec 98<<! 1 2 3 ! exec 99<<! 1 3 ! diff /dev/fd/98 /dev/fd/99
May 17, 2021 at 8:47 comment added Cole @ash Is there a way to make the 2 heredocs work as an input to a command like diff? ie to accomplish diff <heredoc1> <heredoc2>
Jan 5, 2018 at 13:56 history edited Stéphane Chazelas CC BY-SA 3.0
added 252 characters in body
Jan 2, 2017 at 5:11 comment added ash Agreed - where tee does the job, it's a good approach.
Dec 26, 2016 at 11:34 comment added mMontu Instead of using cat and I/O redirection it might be useful to use tee instead
Nov 14, 2016 at 4:28 comment added ash @don_crissti - thanks; I commented on that question. Looks like the Op may have a simpler approach without using here docs.
Aug 29, 2013 at 3:31 comment added ash @OlivierDulac - I added the multiple heredoc example to the answer.
Aug 28, 2013 at 12:45 history edited ash CC BY-SA 3.0
add the example with multiple here-docs and explain
Aug 28, 2013 at 8:58 comment added Olivier Dulac @ash: i'd be interrested in seing an example with multiple heredocs (I never heard of this before today)... how do you stack them?
Aug 28, 2013 at 7:38 vote accept strugee
Aug 28, 2013 at 5:44 comment added strugee let us continue this discussion in chat
Aug 28, 2013 at 5:42 comment added ash Would you like to see a full example that you can try?
Aug 28, 2013 at 5:41 comment added strugee No problem. I understood the concepts, I just couldn't follow your example.
Aug 28, 2013 at 5:40 history edited ash CC BY-SA 3.0
added 92 characters in body
Aug 28, 2013 at 5:38 comment added ash Sorry about that. I know the bash manpage is very long, but it's useful to read and understand. I'll give you the equivalent for that command in another edit.
Aug 28, 2013 at 5:18 comment added strugee Your explanation of shell processing was interesting but over my head :) What I wanted to know was what would be the cat equivalent of echo test > out would be, using a heredoc. Whereas your given example added a redirection at the end of the pipe.
Aug 28, 2013 at 5:14 comment added ash It may help to understand how the shell processes this. When it's evaluating the command-line and finds the <<EOF, it then reads from standard input until either a line with only EOF is found, or end-of-input. Everything else on the original command-line that has yet been unprocessed then continues to process. So, for example, it's possible to do something like this: (cat; echo ---; exec <&3; cat) <<EOF 3<<EOF2 >out and then give that command input with two here-blocks in a row.
Aug 28, 2013 at 5:10 comment added ash I editted the answer with a redirect example; is this the form you wanted editted? If not, can you just give the first line of that part to clarify?
Aug 28, 2013 at 5:10 history edited ash CC BY-SA 3.0
added 119 characters in body
Aug 28, 2013 at 5:07 comment added strugee given the second-to-last example, can you give an example with stdout redirection instead of piping?
Aug 28, 2013 at 4:55 history answered ash CC BY-SA 3.0