Timeline for Does Unix have a command to read from stdin and write to a file (like tee without sending output to stdout)?
Current License: CC BY-SA 4.0
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 11, 2023 at 9:28 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 22 characters in body
|
| Aug 16, 2022 at 15:33 | comment | added | Stéphane Chazelas |
@PatS, try sh -c 'echo "scriptname: $0; 1st arg: $1, 2nd: $2"; will-error-out' A B C D to demonstrate how you pass arguments to an inline script (a script whose contents is passed as the -c argument).
|
|
| Aug 16, 2022 at 14:30 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 357 characters in body
|
| S Aug 16, 2022 at 14:23 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 357 characters in body
|
| Aug 16, 2022 at 14:07 | review | Suggested edits | |||
| S Aug 16, 2022 at 14:23 | |||||
| Aug 11, 2022 at 7:25 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 308 characters in body
|
| Aug 10, 2022 at 19:28 | vote | accept | PatS | ||
| Aug 8, 2022 at 21:21 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 266 characters in body
|
| Aug 8, 2022 at 21:13 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 266 characters in body
|
| Aug 8, 2022 at 20:52 | comment | added | Stéphane Chazelas |
@roaima You need iflag=fullblock in cmd | dd bs=somesize count=1 iflag=fullblock of=file if you want to make sure file contains the first somesize bytes of the output of cmd. You don't need it if you omit count to get the full output of cmd into file.
|
|
| Aug 8, 2022 at 20:49 | comment | added | Chris Davies |
Is GNU particularly less reliable than any other? You need iflag=fullblock when reading variable sized blocks (or maybe just temporarily zero byte blocks) with GNU dd
|
|
| Aug 8, 2022 at 20:47 | comment | added | Stéphane Chazelas |
@roaima, that's GNU specific and not necessary without a count, dd just transfers along what it reads, short read or not.
|
|
| Aug 8, 2022 at 20:46 | comment | added | Chris Davies |
dd iflag=fullblock
|
|
| Aug 8, 2022 at 20:39 | comment | added | Stéphane Chazelas |
@doneal24, cat alone can't do it here, you need it combined with sh to open the file for writing. dd can do the opening and read+write loop, cp as well, though /dev/stdin is not fully portable.
|
|
| Aug 8, 2022 at 20:37 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 230 characters in body
|
| Aug 8, 2022 at 20:37 | comment | added | doneal24 |
I'm not sure I've ever seen you give a answer using dd when either cp or cat would work instead. Is there an equivalent to the useless use of dd?
|
|
| Aug 8, 2022 at 20:32 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 230 characters in body
|
| Aug 8, 2022 at 20:23 | history | answered | Stéphane Chazelas | CC BY-SA 4.0 |