[clug] Bash questions...
Sam Couter
sam at couter.id.au
Tue May 3 04:52:04 MDT 2011
David Deaves <David.Deaves at dd.id.au> wrote:
> There are some very cool things you can do with strings in modern bash, you
> almost never need to fork to some other more capable program (sed, expr, awk ...)
Did you forget Perl?
> of interest the old standards basename and dirname are easily re-implemented
> with the "${path##*/}" (the single arg usage) and "${path%/*}".
To come back to Angus' quote, "basename" and "dirname" are more
meaningful than those blobs of line noise. You need to wrap them in
well-named functions.
> all fork free.
fork on Linux is so cheap we've probably already expended more electrons
discussing it than the average script will save over a lifetime using it.
Measure before optimising.
--
Sam Couter | mailto:sam at couter.id.au
OpenPGP fingerprint: A46B 9BB5 3148 7BEA 1F05 5BD5 8530 03AE DE89 C75C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/linux/attachments/20110503/21153661/attachment.pgp>
More information about the linux
mailing list