On Wed, 4 Nov 2020 16:30:35 -0800, Charles Mills wrote:
>No, I was trying to archive the current directory, and it contained a file
>named -x (created accidentally) and the next folder is named 'foldername' (per
>my original post).
>
>John is saying that the shell expands the folders recursively, so pax sees pax
>blah blah -x foldername ...
>
>And says foldername is an invalid operand for -x.
>
>Comprende?
>
I understand; I'm merely astonished that pax uses shell filename expansion to
build a command line which is passed to pax as a list of individual filenames.
What if a filename contains a metacharacter such as space, newline, '?' or '*'?
any misbehavior should be a reportable error. But my test case below behaves
strangely on Linux. It's inconclusive on MacOS because the Mac filesystem
requires that filenames be valid UTF-8.
-- gil
# ##################################################
#! /bin/sh
# Doc: Create files with non-portable names.
set -x
mkdir Weirdos && cd Weirdos && : >test || exit $?
set +x
awk 'BEGIN {
for ( I = 1; I <256; ++I ) {
FName = sprintf( "%cx %03d foo%cbar", I, I, I )
if ( match( FName, "/" ) ) continue
printf( "%03d\n", I, I ) >FName
close( FName ) }
}'
pax -w . || exit $?
ls -al
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN