By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,957 Members | 1,969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,957 IT Pros & Developers. It's quick & easy.

~ after script filename?

P: n/a
Hello all,

I just wrote a really simple script and named it helloworld.py. Inside
was only:

#!/usr/bin/env
print "Hello, world"

I used chmod to set the permissions, and ran it to see what happened (I
just started learning Python, if you couldn't guess)

Then, I typed ls in the directory to see what was there, and I noticed
a new file, namely helloworld.py~ . What is that file (its contents
are identicle to helloworld.py)? Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and wrote the
script with gedit.

~~Ted Present

Sep 7 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Thus spake presentt (pr******@gmail.com):
Hello all,

I just wrote a really simple script and named it
helloworld.py. Inside was only:

#!/usr/bin/env print "Hello, world"

I used chmod to set the permissions, and ran it to see
what happened (I just started learning Python, if you
couldn't guess)

Then, I typed ls in the directory to see what was there,
and I noticed a new file, namely helloworld.py~ . What is
that file (its contents are identicle to helloworld.py)?
Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and
wrote the script with gedit.


It doesn't have anything to do with Python. I'm pretty sure
you'll find that the file is created by your editor as a
backup or a running store of some kind. Try just editing a
random non-python file with the same editor, and see if you
find the same thing...
Cheers,
Aldo

--
Aldo Cortesi
al**@nullcube.com
http://www.nullcube.com
Off: (02) 9283 1131
Mob: 0419 492 863
Sep 7 '05 #2

P: n/a
Huh, no ~ on other files when I edit them, but at least I don't have to
worry about it. Thanks Aldo.

Sep 7 '05 #3

P: n/a
"presentt" <pr******@gmail.com> wrote:
Huh, no ~ on other files when I edit them, but at least I don't have to
worry about it. Thanks Aldo.


according to

http://www.gnome.org/projects/gedit/

gedit supports backup files, so to figure out how and when they're
created, and how to control their creation, you probably just have
to read the documentation (which doesn't seem to exist on the web;
look in the "help" menu for the bundled version)

</F>

Sep 7 '05 #4

P: n/a
presentt wrote:
Hello all,

I just wrote a really simple script and named it helloworld.py. Inside
was only:

#!/usr/bin/env
print "Hello, world"

I used chmod to set the permissions, and ran it to see what happened (I
just started learning Python, if you couldn't guess)

Then, I typed ls in the directory to see what was there, and I noticed
a new file, namely helloworld.py~ . What is that file (its contents
are identicle to helloworld.py)? Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and wrote the
script with gedit.

~~Ted Present


As others have already said: this is not a python issue.

A ~ suffix is commonly used by editors for backup file. If you save a file
from the editor, and the file already exists (so it doesn't happen the
first time you save a new file), the existing version is renamed with the ~
suffix.

After some time, you will learn to simply ignore these files ;)
Many file managers have already learnt this lesson and have options to hide
such backup files.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Sep 7 '05 #5

P: n/a
presentt wrote:
Hello all,

I just wrote a really simple script and named it helloworld.py. Inside
was only:

#!/usr/bin/env
print "Hello, world"

I used chmod to set the permissions, and ran it to see what happened (I
just started learning Python, if you couldn't guess)

Then, I typed ls in the directory to see what was there, and I noticed
a new file, namely helloworld.py~ . What is that file (its contents
are identicle to helloworld.py)? Why the ~?

Thanks a lot. I'm using Ubuntu Linux 5.04 (Hoary), and wrote the
script with gedit.

~~Ted Present


As others have said, this is a feature of gedit. It can make a
backup copy of the previous version as you save, and can also
automatically save periodically (default seems to be 10 minutes).
From the menus, choose:
Edit -> Preferences
and see the section marked File Saving.

Steve
Sep 7 '05 #6

P: n/a
Oh okay. Thank you all.

Now that you mention it, the ~ makes sense; I know M$ Word uses a ~ in
the temp files that it autosaves periodically. And I think I've seen
it with M$ Notepad too.

Thanks again.

Sep 7 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.