Nautilus Script Fun

Daniel Saunders daniel.saunders at operamail.com
Mon Oct 11 22:07:26 UTC 2004


James McCormick <rantman_2000 <at> yahoo.com> writes:

> 
> Could you tell an ignorant n00b how to write such scripts?  I've never 
> been able to write a usable script, as they always just save as text files.

The trick to make the script executable is to tell the OS that this file is the
kind of file it might like to try and execute.  On a windows box, you'd put a
.exe or a .bat or a .com at the end of the file name.

Linux (and other *nixes) have steered away from the idea of filename extensions
to describe the contents of a file.  Instead, there is information about files
that you can retrieve when you run 'ls -l'.  When you run 'ls -l' the far left
colum will have destriptors like this

-rw-r--r--

(Which means that the files owner can read and write to the file, whereas people
in the file's group and everyone else can only read the file.)

To make your script (let's say it's called 'myscript') executable by you (the
owner of the script), you run the command 'chmod o+x myscript'.  This CHanges
the MODe for the Owner to be eXecutable.  You can also do this for the group
with 'chmod g+x myscript' and 'chmod a+x myscript'.

Using nautilus, you may be able to do the same thing, by right-clicking and
selecting 'properties' which I think gives you a nice point and click way to set
the files permissions.

There are also faster ways to set the files permissions - but I leave that as an
exercise to the reader after he/she reads 'man chmod'.

Daniel








More information about the ubuntu-users mailing list