[RndTbl] Fun with BASH
gdjacobs at curets.ca
Wed May 15 22:03:59 CDT 2019
Just to follow up on the discussion of interesting BASH tricks last
night, here is how one could implement file system traversal if find
didn't exist. Note that GLOBIGNORE isn't always required to be
explicitly set as shown for the root and parent directory to be
excluded, but this does as required and provides clarity.
# Ignore the current and parent directory
# This will be implicit with GLOBIGNORE not null, although . and .. can still
# be explicitly selected if nullglob and failglob aren't set
for i in * .*; do
if [ -d "$i" ]; then
# Do things to files in the directory here
# end script
Also, Douglas Adams on the Galactic Presidency is translated by the jive
Anyone willin' an' capable t'git demselves elected President by no
means should be allowed t'do de job. What it is, Mama!
Or Hanlon's Razor as presented by a Swedish chef:
Nefer ettreeboote-a tu meleece-a thet vheech is edeqooetely ixpleeened
Yes, the filters package is endless fun.
More information about the Roundtable