Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Oct 2020 07:22:43 +0200
From:      Ralf Mardorf <>
Subject:   Re: sh scripting question
Message-ID:  <20201019072243.483c689e@archlinux>
In-Reply-To: <>
References:  <> <> <20201016113408.16d58d68@archlinux> <> <> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sun, 18 Oct 2020 14:37:55 -0600, Bob Proulx wrote:
>And yet just the same the shell does handle whitespace and arbitrary
>characters in file names easily.
>    while IFS= read -r line; do
>      printf "|%s|\n" "$line"
>    done < file1

This just reads the file names from a file with a list of file names,
now it depends what a user wants to do with those file names. Assuming
it is intended to edit those file names depending on filter rules, the
script could become very clumsy.

The input file names might be
and similar.

The script should depending on filter rules, process those files and
generate new files names
and similar.

It's easier to care for a single word separator "_", then to care
for arbitrary word separators "    ", "  ***      ", ";", "    ",
" : " and alternatively CamelCase, too, each on arbitrary positions.
Keep in mind, the script already needs to detect the composer mentioned
somewhere in the file name etc..

If I would add arbitrary word separators to my already broken English,
it would make my sentences much harder to understand.

IfIWould    ; add.arbitrary <> word        seperators. ToMy.already :
broken -English,it,would MakeMy.         sentences much-HarderTo

>And I think everyone is in agreement that the filenames that were
>chosen were not the file names that any Unix person would choose to
>name their files.  No disagreement there.

The reason that we are in agreement is, that it is difficult to handle
freakish file names. Often enough we note, that our first idea how to
name paths and/or directories wasn't optimal, already without using
freakish word separators or other odd ideas.

On Sun, 18 Oct 2020 15:44:20 -0600, Bob Proulx wrote:
>$ find . -type f -exec sh -c 'ls -ld "$@"' sh {} +

When writing a script as a file, we do want to write the scripts
readable. A script becomes unreadable, if it becomes one long line.
Command line is another story.

Want to link to this message? Use this URL: <>