[Gllug] Shell scripts
Nix
nix at esperi.demon.co.uk
Fri May 3 17:06:28 UTC 2002
On Fri, 03 May 2002, tet at accucard.com uttered the following:
[atomic moves]
>>(But you knew that already.)
>
> Yes, I did. I should have mentioned that it was only atomic for moves on
> the same filesystem. But even then, I seem to recall one of the SCO/Veritas
> people (Mark?) claiming that that didn't always hold for certain rare
> cases.
It might not hold for certain insane filesystems; I remember aviro
ranting about the extreme difficulty of moving rename(2) atomic on the
horrible crock that is AFFS.
But modulo bugs, truly weird distributed filesystems and code he hasn't
got to yet, the aviro auto-bug-fixing system should arrange for
rename(2) to be atomic anywhere and everywhere ;}
> How true is it for NFS, for example? Presumably, the underlying
> filesystem move will still be atomic, but will NFS clients still see an
> atomic move?
rename(2) is the *only* operation guaranteed to be atomic on NFS :)
[whitespace-containing filenames]
>>You can mess with the IFS variable to handle that too (at least to some
>>extent).
>
> Yes, but you still have to pick an alternative character, the presence
> of which in a filename would equally cause it to fail.
Hence `to some extent'.
> AFAIK, the only
> two characters guaranteed to never exist in a filename are / and NUL.
> We can't use / for obvious reasons,
I dunno; we could split paths into shell arrays and then use /.
(But that'd be horrible to *use* for anything.)
Or we could use an escape character (and escape that, and so on, akin to
shell \ handling). Again, complex and horrible to use.
> and I don't think the shell handles
> NUL characters very well...
Quite so :(
>>> 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...
>
> Like I said, it's just convention. But conventions make for clarity
> and consistency, and for that reason alone should generally be stuck
> to unless there's good reason not to do otherwise.
Oh, agreed: but I'd never actually noticed that it was a convention at
all, maybe because nobody sticks to it ;)
--
`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