Sample Header Ad - 728x90

Make tar from /dev/stdin file

7 votes
3 answers
6622 views
What I'm looking for is a way to pass in arbitrary data through STDIN, and have it get tar'd up as if its a normal file. I tried this $ echo test | tar -cf test.tar /dev/stdin and that gives me a test.tar file with the contents dev/stdin. The stdin file is a link to /proc/self/fd/0. What I want instead is for dev/stdin inside the TAR file to be a regular file with the text test inside. A similar thing happens with: $ tar -cf test.tar <(echo test) but the names are different. Is this doable?
Asked by Daffy (465 rep)
Aug 5, 2018, 01:52 AM
Last activity: Nov 22, 2024, 10:23 AM