[Gllug] Shell scripts

Nix nix at esperi.demon.co.uk
Fri May 3 14:22:05 UTC 2002


On Fri, 03 May 2002, tet at accucard.com spake:
> mv is an atomic operation in the filesystem (for the common cases, anyway),

mv in the same directory will thunk straight down to rename(2), which is
guaranteed atomic by POSIX.

(But you knew that already.)

It's only if you mv between filesystems that mv will resort to copy-and-
unlink instead of a rename(2).

> Note that this method of iterating throught the files doesn't handle
> filenames containing whitespace, but is otherwise fairly reasonable.

You can mess with the IFS variable to handle that too (at least to some
extent).

> Also note the use of lower case variable names. By convention, upper
> case is reserved for environment variables. Shell variables should be
> lower case.

Hm. I've never stuck to that; maybe I should...

-- 
`Unless they've moved it since I last checked, travelling between
 England and America does not involve crossing the equator.'
   --- pir

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list