Re: missing way to extract data out of data

2021-03-25 Thread felix
I think, memory footprint doesn't really matter when standard availlable ram
is lot away...

But *time required to ``fork''* could matter:

  QuickTest() {
local TIMEFORMAT='%R ( %U + %S )';
printf "%-10s: " "${1##*/}";
time for i in {1..1000};
do
res=$("$@");
done;
[ "$res" != "12" ] && echo "WARN: $1: '$res' != 12."
  }
  CacheHostName=$(&1;
done |
  sort -nk 3

After ~23 seconds, this print (on my host):

  dash  : 1.667 ( 1.206 + 0.519 )
  busybox   : 1.868 ( 1.264 + 0.665 )
  sed   : 2.150 ( 1.364 + 0.841 )
  bash  : 2.201 ( 1.520 + 0.719 )
  perl  : 2.608 ( 1.679 + 0.978 )
  awk   : 2.662 ( 1.666 + 1.041 )
  python: 9.881 ( 6.867 + 3.052 )

Of course, all this was called without modules, so this times represent
something like *minimal footprint when forked to*.

There is no more consideration of efficience when used, for sample, as
filter throught big volume of data, for making complex calculs, etc...

On Wed, Mar 24, 2021 at 10:52:16PM -0400, Dale R. Worley wrote:
> Andreas Schwab  writes:
> > $ size /usr/bin/perl /bin/bash
> >textdata bss dec hex filename
> > 2068661   27364 648 2096673  1ffe21 /usr/bin/perl
> > 1056850   22188   61040 1140078  11656e /bin/bash
> $ size /usr/bin/perl /bin/bash
>text  data bss dec hex filename
>8588   876   0946424f8 /usr/bin/perl
>  898672 36064   22840  957576   e9c88 /bin/bash
> 
> I do suspect that's because perl is using more loadable modules than
...

-- 
 Félix Hauri  --  http://www.f-hauri.ch



Re: Redirection between assignment statement and command name prevents alias substitution

2021-03-25 Thread Robert Elz
Date:Thu, 25 Mar 2021 08:00:20 +0200
From:=?UTF-8?B?T8SfdXo=?= 
Message-ID:  


  | They are fine as an interactive feature but definitely don't belong in
  | shell scripts.

They're not fine anywhere, anything sane that can be done with an alias
can be done better with a function.

Omitting them from the standard would stop forcing shells to implement this
nonsense, and allow it to wither and die.

  | Besides the ordinary user doesn't expect anything beyond simple aliases
  | like `la='ls -A' ll='ls -lh''

la() { command ls -A "$@"; };  ll() { command ls -lh "$@"; }

Slightly longer to type, but just as good, and if desired, can easily
be extended to do so much more (different default options depending upon
which directory you're in, ...)

kre

ps: "command" in the functions is just in case ls also becomes a function,
and those ones want to run the real ls, but that's optional, it all depends
what is wanted ... with functions you get a choice.




Re: Redirection between assignment statement and command name prevents alias substitution

2021-03-25 Thread Chris F.A. Johnson

On Thu, 25 Mar 2021, Oğuz wrote:


24 Mart 2021 Çarşamba tarihinde Robert Elz  yazdı:


Date:Wed, 24 Mar 2021 11:15:11 +0300
From:=?UTF-8?B?T8SfdXo=?= 
Message-ID:  

  | I think I got the general idea of aliases now

I'm not sure why you want or need that, aliases
are dumb (bizarre) and shoukd be deleted...

I keep trying to get tge POSIX people to
remove them from the standard.  They keep ignoring me.  Shells won't drop
support, but at least
no-one woukd be able to rely on them working,
or working any particular way any more.



They are fine as an interactive feature but definitely don't belong in
shell scripts.


The only place I've ever used aliases is in a script:

alias show_command='[ $verbose -gt ${debuglevel:-0} ] && printf "%s" "++ $FUNCNAME " "${@/%/ 
}" && echo '

I couldn't use a function (which I do for all interactive uses) because that 
would change $FUNCNAME.


--
   Chris F.A. Johnson 
   === Author: ===
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
   Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress)


Re: Redirection between assignment statement and command name prevents alias substitution

2021-03-25 Thread Oğuz
25 Mart 2021 Perşembe tarihinde Chris F.A. Johnson 
yazdı:

> On Thu, 25 Mar 2021, Oğuz wrote:
>
> 24 Mart 2021 Çarşamba tarihinde Robert Elz  yazdı:
>>
>> Date:Wed, 24 Mar 2021 11:15:11 +0300
>>> From:=?UTF-8?B?T8SfdXo=?= 
>>> Message-ID:  >> k0pzmyz8_pnpljtk4es...@mail.gmail.com>
>>>
>>>   | I think I got the general idea of aliases now
>>>
>>> I'm not sure why you want or need that, aliases
>>> are dumb (bizarre) and shoukd be deleted...
>>>
>>> I keep trying to get tge POSIX people to
>>> remove them from the standard.  They keep ignoring me.  Shells won't drop
>>> support, but at least
>>> no-one woukd be able to rely on them working,
>>> or working any particular way any more.
>>>
>>
>>
>> They are fine as an interactive feature but definitely don't belong in
>> shell scripts.
>>
>
> The only place I've ever used aliases is in a script:
>
> alias show_command='[ $verbose -gt ${debuglevel:-0} ] && printf "%s" "++
> $FUNCNAME " "${@/%/ }" && echo '
>
> I couldn't use a function (which I do for all interactive uses) because
> that would change $FUNCNAME.


FUNCNAME is an array. Inside a function `${FUNCNAME[1]}' expands to its
caller's name. If you declared `show_command' as a function, you'd have to
call it like `show_command "$@"' though, there is no other way for a
function to access its caller's positional parameters as far as I'm
concerned.


>
>
> --
>Chris F.A. Johnson 
>=== Author: ===
>Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
>Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress)
>


-- 
Oğuz