[RndTbl] Fun with BASH
Tim Lavoie
tim at fractaldragon.net
Thu May 16 01:05:08 CDT 2019
I'd mostly forgotten about the filters like Chef. I used to take some
juvenile amusement in piping articles from rec.arts.erotica through
those for that special Sexy Swedish Chef.
Geoffrey Jacobs <gdjacobs at curets.ca> writes:
> 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.
>
> #!/bin/bash
> GLOBIGNORE=". .."
> # 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
>
> descend() {
> for i in * .*; do
> if [ -d "$i" ]; then
> pushd "$i"
> descend
> # Do things to files in the directory here
> popd
> fi
> done
> }
>
> descend
> # end script
>
> Also, Douglas Adams on the Galactic Presidency is translated by the jive
> filter:
>
> 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
> by stoopeedity.
>
> Yes, the filters package is endless fun.
>
> _______________________________________________
> Roundtable mailing list
> Roundtable at muug.ca
> https://muug.ca/mailman/listinfo/roundtable
More information about the Roundtable
mailing list