i use a getopts construct which was suggested by Glenn Fowler on the old AT&T AST mailing list to generate indented, bold example lines followed by further-indented, normal-mode explanatory text; see https://www.mail-archive.com/ast-users@lists.research.att.com/msg00054.html for details
when i run the below script containing his example, in the tw -e "uid != 'bozo' || (mode & 'go=w')" line, the bold formatting ends at the || and the rest of the line, (mode & 'go=w')", is printed in normal mode
tested in homebrew 1.0.10 2024-08-01, but i've also checked as far back 93p (the earliest ksh93 i have access to), and the behavior there is identical
$ cat ./a.sh
#!/usr/bin/env ksh
USAGE+=$'[-?1.0.0][+NAME?foo - foo]'
USAGE+=$'[+DESCRIPTION?foo]'
USAGE+=$'[+EXAMPLES]'
USAGE+=$' {'
USAGE+=$' [+tw?Lists the current directory tree.]'
USAGE+=$' [+tw chmod go-w?Turns off the group and other write permissions'
USAGE+=$' for all files in the current directory tree using a minimal'
USAGE+=$' amount of \bchmod\b(1) command execs.]'
USAGE+=$' [+tw -e \"uid != \'bozo\' || (mode & \'go=w\')\"?Lists all'
USAGE+=$' files in the current directory that don\'t belong to the user'
USAGE+=$' \bbozo\b or have group or other write permission.]'
USAGE+=$' }'
USAGE+=$'[-author?Aaron Davies]'
USAGE+=$'\n'
USAGE+=$'\n'
while getopts -a "${.sh.file##*/}" "$USAGE" OPTOPT
do
:
done
$ ./a.sh --man
NAME
foo - foo
SYNOPSIS
foo [ options ]
DESCRIPTION
foo
EXAMPLES
tw Lists the current directory tree.
tw chmod go-w
Turns off the group and other write permissions for all files in the current directory tree using a minimal amount of chmod(1) command execs.
tw -e "uid != 'bozo' || (mode & 'go=w')"
Lists all files in the current directory that don't belong to the user bozo or have group or other write permission.
IMPLEMENTATION
version 1.0.0
author Aaron Davies
$
this doesn't happen with --nroff:
$ ./a.sh --nroff 2>&1|grep bozo
.H1 tw\ \-e\ "uid\ !=\ 'bozo'\ ||\ (mode\ &\ 'go=w')"
\fBbozo\fP or have group or other write permission\&.
$
i use a
getoptsconstruct which was suggested by Glenn Fowler on the old AT&T AST mailing list to generate indented, bold example lines followed by further-indented, normal-mode explanatory text; see https://www.mail-archive.com/ast-users@lists.research.att.com/msg00054.html for detailswhen i run the below script containing his example, in the
tw -e "uid != 'bozo' || (mode & 'go=w')"line, the bold formatting ends at the||and the rest of the line,(mode & 'go=w')", is printed in normal modetested in homebrew 1.0.10 2024-08-01, but i've also checked as far back 93p (the earliest ksh93 i have access to), and the behavior there is identical
this doesn't happen with
--nroff: