Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #269885
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: tree with dir size |
| Date | 2024-06-03 21:10 +0200 |
| Message-ID | <ILle9-nkr-1@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <IKfXb-hhoO-1@gated-at.bofh.it> <IKgJz-hhTQ-25@gated-at.bofh.it> <ILgo9-kbf-1@gated-at.bofh.it> <ILh0R-kDd-7@gated-at.bofh.it> <ILle9-nkr-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jun 03, 2024 at 01:11:57PM -0500, David Wright wrote:
> On Mon 03 Jun 2024 at 10:32:16 (-0400), Greg Wooledge wrote:
> > duhs() (
> > shopt -s dotglob
> > printf '%s\0' "${1:-.}"/*/ | xargs -0 du -sh
> > )
> >
> > I'm not personally fond of this. It's extremely easy to overlook
> > the fact that the curly braces have been replaced with parentheses,
> I guess minimalists would make a one-liner out of that.
> Myself, I prefer verbosity, and the ability to search and find
> all my functions with /function.*{$ in less. For example,
> I write what is probably my most trivial function in .bashrc as:
>
> function _Cat_ {
> cat
> }
>
> rather than:
>
> _Cat_() { cat; }
... I feel like you've just exemplified what I was talking about, missing
the fact that the curly braces were replaced with parentheses around the
function body to force a subshell every time it's called.
It had nothing to do with how many lines of code were used. I could
have written them as
duhs() { (shopt -s dotglob; printf '%s\0' "${1:-.}"/*/ | xargs -0 du -sh); }
and
duhs() (shopt -s dotglob; printf '%s\0' "${1:-.}"/*/ | xargs -0 du -sh)
and the same point would have applied.
> function _Cat_ {
Do note that the "function" keyword is a bash/ksh extension, and not
part of POSIX sh syntax. In bash, "x()" and "function x" are identical
in behavior. In ksh, they cause two different kinds of variable scoping
behavior. Bash also allows "function x()" which ksh does not.
Just for the record.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
tree with dir size Northwind <nw@secubox.org> - 2024-05-31 00:30 +0200
Re: tree with dir size eben@gmx.us - 2024-05-31 01:00 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 01:00 +0200
Re: tree with dir size Northwind <nw@secubox.org> - 2024-05-31 01:00 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 01:10 +0200
Re: tree with dir size eben@gmx.us - 2024-05-31 02:10 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 02:20 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-05-31 21:20 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 22:10 +0200
Re: tree with dir size David Wright <deblis@lionunicorn.co.uk> - 2024-06-01 04:40 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-01 05:20 +0200
Re: tree with dir size Lee <ler762@gmail.com> - 2024-06-01 16:20 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-03 16:00 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-03 16:40 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-03 21:10 +0200
Re: tree with dir size David Wright <deblis@lionunicorn.co.uk> - 2024-06-04 02:40 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-03 22:50 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-04 00:30 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-04 03:50 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-04 16:50 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-04 16:50 +0200
Re: tree with dir size Andy Smith <andy@strugglers.net> - 2024-06-03 16:40 +0200
Re: tree with dir size <tomas@tuxteam.de> - 2024-06-03 19:10 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-03 23:00 +0200
Re: tree with dir size <tomas@tuxteam.de> - 2024-06-03 16:40 +0200
Re: tree with dir size Sridhar M A <alaymari@gmail.com> - 2024-05-31 02:50 +0200
Re: tree with dir size Felix Miata <mrmazda@earthlink.net> - 2024-05-31 03:30 +0200
csiph-web