[H-GEN] ksh scripting problem
Anthony Towns
aj at azure.humbug.org.au
Sat Aug 23 14:28:33 EDT 2003
On Sun, Aug 24, 2003 at 01:35:05AM +0930, Scott Pullen wrote:
> How do I copy files using the i-node instead of the filename?
You can't.
> The reason I ask is that I am using a for loop using filenames/directories
> that may contain spaces.
Yup, that doesn't work.
> for $entity in `ls $source$entry`
^ tsk.
Another way of doing this is:
ls $source$entry | while read entity
which will handle spaces differently, but not necessarily more
reliably. You're probably better off using shell globs.
> do
> if [[ -d $entity ]]; then
> recursively call function
> fi
find(1) is generally a better way of doing this.
> I thought of
> using the i-node which prompted the above question but I can't work out how
> to copy the files without using the find command which I think is
> inefficient.
You can't reference a file by its inode - only the kernel can do
that. Once you've got a file, you can work out its inode, but that's
not the same thing.
Should I be offering you good luck on your assignment at this point?
Cheers,
aj
--
Anthony Towns <aj at humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG signed mail preferred.
``Is this some kind of psych test?
Am I getting paid for this?''
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: not available
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20030824/1c1e0722/attachment.sig>
More information about the General
mailing list