[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: TBird mail



On Wed, Dec 07, 2022 at 07:56:53AM -0500, rhkramer@gmail.com wrote:
> On Wednesday, December 07, 2022 07:18:57 AM Greg Wooledge wrote:
> > Here's my version:
> > 
> > rlart() {
> >   local day time path
> >   find "${1:-.}" -type f -printf '%T@ %TY-%Tm-%Td %TT %p\0' |
> >     sort -zn |
> >     while read -rd '' _ day time path; do
> >       printf '%s %s %s\n' "$day" "${time%.*}" "$path"
> >     done
> > }
> 
> I wonder if youi could expound somewhat on that:
> 
> (Aside: although I use bash, and have written a few simple scripts, I am by no 
> means a bash guru.)
> 
>    * Might I infer that you have some large bash (presumably) script (file) 
> containing various functions (e.g., rlart) to perform a variety of tasks?

It's defined in my .bashrc file, so that I can call it interactively.

>    * If so, how do you invoke those functions (I mean the syntax) -- I guess 
> it would be something like:
> 
> $ <name of script file> rlart(<parameter(s)>)

No, the function is defined directly in my interactive shell, because
of the lines in .bashrc.  So I just call it by name:

unicorn:~/tmp$ rlart | tail
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/zmalloc.o
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/fin.o
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/files.o
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/scancode.c
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/scancode.o
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/matherr.o
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/fcall.o
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/version.o
2021-08-23 13:10:38 ./mawk-1.3.4-20200120/mawk
2022-12-06 21:55:39 ./shot.png

If you prefer, you could place the code in a script.  The script would
be named "rlart", and it would need to be in a directory in your PATH.
Remove the function wrapper and the "local" declaration, and include
a proper shebang line (#!/bin/bash since I'm using bash extensions),
and of course chmod +x the script.


Reply to: