unquote
—
execute a program with safely quoted arguments
unquote |
[-f fields]
[-0 | -N ]
[-hnpqRVv ] fields
command [args ...] |
The unquote
utility executes
command with the specified arguments after unquoting the
specified fields. The fields
argument, which may be specified in various ways, is a colon-delimited list of
numbers, following the Unix/C convention that command is
argument 0, args starting from 1. Each argument in the
list is interpreted as a hex-encoded string, with two hex digits for each
character.
The list of arguments to be quoted is constructed in the following
way:
- The environment variable
UNQUOTE_ARGS
is examined,
and if it is set, the string it contains is parsed as a
fields list.
- Any
-f
arguments are parsed and
added to the (possibly empty) list, not replacing any of
its contents.
- The first non-option argument, fields, is examined,
and also added to the (possibly empty) list, not
replacing any of its contents.
The following options are available:
-0
- If
-n
is also specified, separate arguments in the
output with ASCII NUL characters (character code 0). This option cannot be
used at the same time as -N
.
-f
fields
- Specify a list of args to unquote before executing
command.
-h
- Display a short help message and exit.
-N
- If
-n
is also specified, separate arguments in the
output with a newline. This option cannot be used at the same time as
-0
.
-n
- Do not actually execute command, just print out its
expanded form.
-p
- Do not search the environment variable
PATH
for
the specified command. If this flag is specified,
unquote
uses
execv(3)
instead of
execvp(3)
to execute the command. In other words, command
should be a full path to an executable program;
PATH
is not searched.
-q
- Quiet operation; even more quiet when more than one
-q
flag is specified.
-R
- Do the exact opposite of normal operation: quote the arguments instead of
unquoting them. Useful when one needs to test a program with a long quoted
argument.
-V
- Display version information and exit. When combined with one or more
-v
switches, unquote
also
attempts to display information about its build environment.
-v
- Verbose operation; even more verbose when more than one
-v
flag is specified.
The following environment variables affect the execution of
unquote
:
UNQUOTE_ARGS
- Specify a list of args to unquote before executing
command.
None relevant in the present version.
unquote 1 /bin/echo
54657374
Display ‘Test’.
unquote 2
/usr/local/vpopmail/bin/vadduser testuser 255465737424
Add a vpopmail user ‘testuser’ with a password
‘%Test$’.
Should command-line fields and -f
arguments override UNQUOTE_ARGS
?
Written by Peter Pentchev in 2001.
Peter Pentchev ⟨roam@ringlet.net⟩.