Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #286743
| From | John Hasler <john@sugarbit.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: a hopefully simple ls command question? |
| Date | 2026-05-17 22:10 +0200 |
| Message-ID | <MVPYd-5TA6-1@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <MVsoV-5CXY-5@gated-at.bofh.it> <MVsRX-5Dqo-1@gated-at.bofh.it> <MVtO2-5E2T-11@gated-at.bofh.it> <MVCeB-5Kcg-3@gated-at.bofh.it> <MVCeB-5Kcg-1@gated-at.bofh.it> |
| Organization | Dancing Horse Hill |
Copy the script below to your home directory on your shell server.
I call the script "findbetween" but you can rename it if you wish.
Run this command:
chmod a+x findbetween
Run this command:
alias findbetween="$HOME/findbetween"
Typing findbetween should now print a usage message.
Adding the above command to the end of the .bash_profile file in
your home directory should make the change permanent.
-----NEXT LINE IS FIRST LINE OF THE SCRIPT----
#!/bin/bash
# This program is free software. You may treat it as if it were
# in the public domain. You are free to make and distribute copies
# and derivatives. John Hasler 2026-05-17
if [ "$#" -ne 2 ]; then
cat <<EOF
This program lists files in the current directory that are newer or as new as
the first date on the command line but no newer than the second one.
The dates must be in ISO standard form (without seconds) and in single quotes.
The exact format is important. Note the leading zeros.
Example:
'2026-05-12 09:41' '2026-05-16 20:52'
EOF
exit 1
fi
startdate=$1
enddate=$2
export startdate
export enddate
ls -tuo --full-time | awk '
{start = ENVIRON["startdate"]}
{end = ENVIRON["enddate"]}
{date = $5 " " substr($6, 1, 5)}
{if (date >= start && date <= end) print date " " $8 }
'
-----PREVIOUS LINE IS THE LAST LINE OF THE SCRIPT----
Note that the last line of the script contains only
a single "'".
--
John Hasler
john@sugarbit.com
Elmwood, WI USA
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar
a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 06:00 +0200
Re: a hopefully simple ls command question? David Christensen <dpchrist@holgerdanske.com> - 2026-05-16 06:30 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 09:20 +0200
Re: a hopefully simple ls command question? debian-user@howorth.org.uk - 2026-05-16 12:20 +0200
Re: a hopefully simple ls command question? David Christensen <dpchrist@holgerdanske.com> - 2026-05-17 08:00 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-17 23:20 +0200
Re: a hopefully simple ls command question? Teemu Likonen <tlikonen@iki.fi> - 2026-05-16 07:00 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 09:20 +0200
Re: a hopefully simple ls command question? Dan Ritter <dsr@randomstring.org> - 2026-05-16 10:20 +0200
Re: a hopefully simple ls command question? Greg Wooledge <greg@wooledge.org> - 2026-05-16 14:50 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 22:30 +0200
Re: a hopefully simple ls command question? Greg Wooledge <greg@wooledge.org> - 2026-05-16 22:50 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 23:10 +0200
Re: a hopefully simple ls command question? debian-user@howorth.org.uk - 2026-05-17 18:40 +0200
Re: a hopefully simple ls command question? Dan Ritter <dsr@randomstring.org> - 2026-05-17 01:00 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-17 02:30 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-17 07:30 +0200
Re: a hopefully simple ls command question? John Hasler <john@sugarbit.com> - 2026-05-17 15:20 +0200
Re: a hopefully simple ls command question? John Hasler <john@sugarbit.com> - 2026-05-17 22:10 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-18 00:10 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-18 05:50 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-18 07:00 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-18 07:40 +0200
Re: a hopefully simple ls command question? David Wright <deblis@lionunicorn.co.uk> - 2026-05-18 05:30 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 22:40 +0200
Re: a hopefully simple ls command question? Chime Hart <chime@hubert-humphrey.com> - 2026-05-16 22:50 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 23:10 +0200
Re: a hopefully simple ls command question? CGS <etphonehomefrance@gmail.com> - 2026-05-17 16:40 +0200
Re: a hopefully simple ls command question? Karen Lewellen <klewellen@shellworld.net> - 2026-05-16 21:00 +0200
Re: a hopefully simple ls command question? Karl Vogel <vogelke+debian@pobox.com> - 2026-05-16 21:50 +0200
Re: a hopefully simple ls command question? Greg Wooledge <greg@wooledge.org> - 2026-05-16 21:30 +0200
Re: a hopefully simple ls command question? Andrew Latham <lathama@gmail.com> - 2026-05-16 21:30 +0200
csiph-web