Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.shell > #4458
| From | Ivan Shmakov <oneingray@gmail.com> |
|---|---|
| Newsgroups | comp.unix.shell |
| Subject | "a file which at this time has no name" |
| Date | 2012-03-14 23:48 +0700 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <86pqcf86x1.fsf_-_@gray.siamics.net> (permalink) |
| References | <55e8c993-a9ca-4e30-a85c-18430f2eb025@db5g2000vbb.googlegroups.com> <86pqcfbvud.fsf@gray.siamics.net> <0844dc91-9a86-4c72-be7f-39fd85fc1f0d@t16g2000yqt.googlegroups.com> |
>>>>> Paul Branon <paulbranon@googlemail.com> writes:
>> Not necessarily. If named
> How do you create a file with no name?
By removing the filename after the file is created. Like:
$ f=$(mktemp -t)
$ exec 5<> "$f"
$ echo Hello, world! >&5
$ perl -w read.perl <&5
Hello, world!
$ rm -v -- "$f"
removed `/tmp/tmp.iaiCmrwfHE'
$ perl -w read.perl <&5
Hello, world!
$ echo And one more time... >&5
$ perl -w read.perl <&5
Hello, world!
And one more time...
$
So, I can open a temporary file, remove its name, and still be
able to read from and write to it.
Since I don't know how to set the file's "offset" in pure Shell,
I had to use the following simplistic Perl script to read the
file from its very first (or, rather, zeroth) byte to the last.
$ cat < read.perl
seek (\*STDIN, 0, 0)
or die ();
{
local ($/) = "";
my $a
= <STDIN>
// die ();
print ($a);
}
$
--
FSF associate member #7257
Back to comp.unix.shell | Previous | Next — Previous in thread | Next in thread | Find similar
empty file is simply an inode with sort of null pointers Andre Aitken <andre.aitken.a@gmail.com> - 2012-03-13 21:46 -0700
Re: empty file is simply an inode with sort of null pointers Ivan Shmakov <oneingray@gmail.com> - 2012-03-14 12:22 +0700
Re: empty file is simply an inode with sort of null pointers Paul Branon <paulbranon@googlemail.com> - 2012-03-14 08:54 -0700
Re: empty file is simply an inode with sort of null pointers Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-14 17:17 +0100
Re: empty file is simply an inode with sort of null pointers Aragorn <stryder@telenet.be.invalid> - 2012-03-15 03:36 +0100
Re: empty file is simply an inode with sort of null pointers Stephane Chazelas <stephane_chazelas@yahoo.fr> - 2012-03-15 08:19 +0000
Re: empty file is simply an inode with sort of null pointers Barry Margolin <barmar@alum.mit.edu> - 2012-03-15 10:59 -0400
Re: empty file is simply an inode with sort of null pointers Aragorn <stryder@telenet.be.invalid> - 2012-03-19 07:22 +0100
Re: empty file is simply an inode with sort of null pointers William Ahern <william@wilbur.25thandClement.com> - 2012-03-18 23:57 -0700
"a file which at this time has no name" Ivan Shmakov <oneingray@gmail.com> - 2012-03-14 23:48 +0700
Re: lseek(2) operators in shells Stephane Chazelas <stephane_chazelas@yahoo.fr> - 2012-03-14 17:11 +0000
Re: lseek(2) operators in shells Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2012-03-14 17:44 +0000
Re: lseek(2) operators in shells Kaz Kylheku <kaz@kylheku.com> - 2012-03-14 18:10 +0000
Re: lseek(2) operators in shells "Chris F.A. Johnson" <cfajohnson@gmail.com> - 2012-03-14 15:20 -0400
Re: lseek(2) operators in shells Kaz Kylheku <kaz@kylheku.com> - 2012-03-14 19:46 +0000
Re: lseek(2) operators in shells Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-15 00:14 +0100
Re: lseek(2) operators in shells "Mirko K." <mirkok.lists@googlemail.com> - 2012-03-15 00:45 +0100
Re: lseek(2) operators in shells Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-15 01:11 +0100
Re: lseek(2) operators in shells Kaz Kylheku <kaz@kylheku.com> - 2012-03-15 00:27 +0000
Re: lseek(2) operators in shells "Mirko K." <mirkok.lists@googlemail.com> - 2012-03-15 01:35 +0100
Re: lseek(2) operators in shells Kaz Kylheku <kaz@kylheku.com> - 2012-03-15 00:42 +0000
Re: lseek(2) operators in shells Headless /body <devnull@NotReallyAn.example.com> - 2012-03-14 22:49 -0400
Re: lseek(2) operators in shells Stephane Chazelas <stephane_chazelas@yahoo.fr> - 2012-03-15 08:17 +0000
Re: lseek(2) operators in shells Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-15 09:32 +0100
Re: lseek(2) operators in shells Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-15 09:26 +0100
Re: lseek(2) operators in shells Barry Margolin <barmar@alum.mit.edu> - 2012-03-14 15:48 -0400
Re: lseek(2) operators in shells Headless /body <devnull@NotReallyAn.example.com> - 2012-03-14 22:58 -0400
Re: lseek(2) operators in shells Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-14 20:28 +0000
Re: lseek(2) operators in shells Guillaume Dargaud <use_the_contact_form@www.gdargaud.net> - 2012-03-15 08:43 +0100
dereferencing links to man(1) pages Ivan Shmakov <oneingray@gmail.com> - 2012-03-15 15:03 +0700
Re: dereferencing links to man(1) pages Stephane Chazelas <stephane_chazelas@yahoo.fr> - 2012-03-15 13:36 +0000
Re: dereferencing links to man(1) pages Dan Espen <despen@verizon.net> - 2012-03-15 10:02 -0400
Re: lseek(2) operators in shells Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-15 12:40 +0000
Re: lseek(2) operators in shells Barry Margolin <barmar@alum.mit.edu> - 2012-03-15 10:56 -0400
Re: lseek(2) operators in shells Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-15 15:13 +0000
Re: lseek(2) operators in shells Barry Margolin <barmar@alum.mit.edu> - 2012-03-15 13:09 -0400
Re: lseek(2) operators in shells Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-15 17:29 +0000
Re: "a file which at this time has no name" Paul Branon <paulbranon@googlemail.com> - 2012-03-15 05:27 -0700
Re: "a file which at this time has no name" Ivan Shmakov <oneingray@gmail.com> - 2012-03-15 20:46 +0700
Re: "a file which at this time has no name" "Mirko K." <mirkok.lists@googlemail.com> - 2012-03-15 22:29 +0100
Re: "a file which at this time has no name" William Ahern <william@wilbur.25thandClement.com> - 2012-03-15 17:55 -0700
Re: "a file which at this time has no name" pacman@kosh.dhis.org (Alan Curry) - 2012-03-16 01:09 +0000
Re: "a file which at this time has no name" Ivan Shmakov <oneingray@gmail.com> - 2012-03-16 09:33 +0700
Re: "a file which at this time has no name" pacman@kosh.dhis.org (Alan Curry) - 2012-03-16 09:51 +0000
Re: "a file which at this time has no name" "Mirko K." <mirkok.lists@googlemail.com> - 2012-03-16 18:27 +0100
Re: "a file which at this time has no name" Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2012-03-16 14:39 +0000
Re: empty file is simply an inode with sort of null pointers Kaz Kylheku <kaz@kylheku.com> - 2012-03-14 17:30 +0000
csiph-web