Liste des Groupes | Revenir à cu shell |
Janis Papanagnou <janis_papanagnou+ng@hotmail.com>:How would the main function look like that I could embed in my call to
make a numerically sorted list. Say, something like, for example,
>
viewer $( p_sort P*.HTM )
>
where p_sort would be the Python code. - Note: this is no appropriate
solution since it would anyway not work correctly for file names with
embedded blanks and newlines. I just want to get a closer
understanding how you think this would be usable in shell (or from
shell). Thanks.
If ‘p_sort’ is designed to output the sorted file names separated by an
ASCII NUL character rather than a newline then, using the GNU version of
‘xargs’, one can feed that output into ‘xargs’:
{
p_sort P*.HTM 3<&- |
xargs --null --no-run-if-empty -- sh -c \
'exec 0<&3 3<&- "$@"' sh \
viewer
} 3<&0
This will avoid the problems with funny characters (including blanks and
linefeeds) in filenames processed by the shell.
Les messages affichés proviennent d'usenet.