[clug] Going from 1 to 100 lines of ls wrapping script
hal at ashburner.info
Tue Nov 26 21:36:18 MST 2013
On 27 November 2013 14:13, steve jenkin <sjenkin at canb.auug.org.au> wrote:
> Here's the reality:
> - Unix/POSIX/Linux has since before 1980 been "the universal glue", it
> talks to _everything_ and has to accommodate
> - The Unix/POSIX shells, plural, aren't just standard and (mostly)
> portable, but anyone can build on them and DO IT BETTER if they want.
> compare to 'command.com' and descendants... Learnt nothing, never evolved.
> "Powershell" is a great leap forward, but isn't portable, nor even
> back-ported. Could you imagine that being accepted and not addressed in
> the POSIX world???
Nope, you lost me here.
Gnu does nothing if not extend POSIX. If you put #!/bin/bash at the top of
your script you absolutely cannot expect to use every bash feature and be
compatible with any compliant /bin/sh
Eg busybox /bin/sh - I'd be amazed (but delighted) if the lsd script would
run on busybox.
I spoke not of "replacing ls" but merely adding yet another (IMHO useful -
but maybe not very given the lack of interest in the fix compared to the
original query about the problem) switch to ls.
would filter ls output and only show what passes "/usr/bin/test -d
$dirent", this obviously trivially extends to all the arguments to
/usr/bin/test. So I did that for me in a shell script in a way that is
marginally better than the 1 liner i was using before.
Now that looks exactly like the gnu philosphy to me, yeah it's useful, no
it won't break existing code, yeah the approach is unsurprising, hack it in
go! Every existent ls feature and switch would remain unchanged. (ls -Q
works, as does ls --filter_test=d -Q) Do note that you would not actually
use /usr/bin/test or require it, ls actually knows the type of each dirent,
it just can't filter them to only show you what you want. Maybe think of it
as a more useful --classify or --group-directories-first. ls does filter of
coruse for leading dots on the dirent name.
But hey, it's not a remotely important problem. There are many inelegant
solutions, including as listed abusing shell expansion, concocting a find
command then passing the output through sed, even writing your own lsd
I gave no insight at all in any way on gnu core maintainers other than if
CLUG ain't interested maybe that's because it's not interesting and so the
logical inference is don't waste their time or mine with it. I do find "my
$OS is more betterer than yours" a silly argument and hoped to capture that
silliness. However, "I *like* the OS I use." Is quite a nice statement and
hopefully one we will hear more and more of for many different values of OS
as things generally improve over time with or without our assistance.
More information about the linux