On Mon, 16 Jul 2001 00:57, Tim Holmes wrote:
> Maybe somebody can shed some light on this subject.
>
> I write a lot of scripts, and I go back and revise them as well. Well I
> keep noticing files that have a ~ at the end of the file. For example,
> one of the first scripts I tested when learning expect.
>
> [timh@r2d2 bin]$ ls -la aftp*
> -rwxr-xr-x 1 timh timh 142 Jul 15 10:53 aftp*
> -rwxr-xr-x 1 timh timh 142 Jul 1 19:45 aftp~*
>
> But the files are the same.
>
> [timh@r2d2 bin]$ diff aftp aftp~
>
> They both look like this.
>
> [timh@r2d2 bin]$ cat aftp
> #!/usr/bin/expect
> log_user 0
> proc domainname {} {
> set file [open /etc/resolv.conf r]
> while {[gets $file buf] != -1} {
> if {[scan $buf "domain %s" name] ==1} {
> close $file
> return $name
> }
> }
> close $file
> error "No domain declaration in /etc/resolv.conf"
> }
> spawn ftp $argv
> expect "Name"
> send "anonymous\r"
> expect "Password:"
> send "anon@[domainname]\r"
> log_user 1
> interact
>
> But as soon as I edit it, then close it out, there's a "temp" file there
> and it always ends in ~. What's this all about? How long do these files
> stick around? I've often just gone and removed them, but now I'm real
> curious as to what's the point of them.
>
> Thanks for the help.
> tdh
I believe that they are just backups made automatically by your text editor,
whenever you save. That way, you have something to go back to if you mess
your file up.
--
Sridhar Dhanapalan.
"There are two major products that come from Berkeley:
LSD and UNIX. We don't believe this to be a coincidence."
-- Jeremy S. Anderson