What's a script?

Amedee @ Ubuntu amedee-ubuntu at amedee.be
Mon Jul 13 07:33:01 UTC 2009


On Mon, July 13, 2009 08:01, Al Black wrote:
> Hey Mark,
>
> On Sun, 2009-07-12 at 22:37 +0000, Mark C. Miller wrote:
>> I'm a newbie and know nothing about programming.  Here's a line I
>> grabbed
>> from another thread ...
>
> Just one minor thing to what the others have said about scripts.  Don't
> forget to "comment" your scripts.  For example I'll often put in
> comments about the command or the rationale for doing it the way I did.
> For example I might do something like this for copying files ... in
> script...
>
> # copy files to destination, but only when new or newer
>
> cp -u *.* to /home/al/somedirectory ...
>
>
> You see that comments explains why I used the -u option for the command
> "cp".

I have another suggestion.
A lot of commands have a short an a long version of their options. For
example, cp -a is the same as cp --archive.
I prefer to use the long versions when I write my own scripts. It makes
them more readable.

HTH, HAND.
-- 
Amedee





More information about the ubuntu-users mailing list