summary refs log tree commit diff
path: root/bin/man1
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-02-24 14:45:12 -0500
committerJune McEnroe <june@causal.agency>2019-02-24 14:45:12 -0500
commit8557319c4b0456d7660b8d3185430181f5cb2e44 (patch)
tree7b37f3bc0a3ce1cdc3aacd5080d08d62cbed5868 /bin/man1
parentMatch make targets as Tag (diff)
downloadsrc-8557319c4b0456d7660b8d3185430181f5cb2e44.tar.gz
src-8557319c4b0456d7660b8d3185430181f5cb2e44.zip
Add setopt
Diffstat (limited to 'bin/man1')
-rw-r--r--bin/man1/setopt.148
1 files changed, 48 insertions, 0 deletions
diff --git a/bin/man1/setopt.1 b/bin/man1/setopt.1
new file mode 100644
index 00000000..a148b28f
--- /dev/null
+++ b/bin/man1/setopt.1
@@ -0,0 +1,48 @@
+.Dd February 24, 2019
+.Dt SETOPT 1
+.Os
+.
+.Sh NAME
+.Nm setopt
+.Nd parse command options
+.
+.Sh SYNOPSIS
+.Nm
+.Ar optstring
+.Op Ar args ...
+.
+.Sh DESCRIPTION
+.Nm
+behaves similarly to
+.Xr getopt 1 ,
+except that it produces quoted output
+appropriate for use with the
+.Nm eval
+shell builtin.
+This allows arguments containing whitespace
+to survive parsing.
+.
+.Sh EXAMPLES
+.Bd -literal -offset indent
+args=$(setopt abo: "$@")
+eval set -- "$args"
+.Ed
+.
+.Sh SEE ALSO
+.Xr getopt 1 ,
+.Xr sh 1 ,
+.Xr getopt 3
+.
+.Sh HISTORY
+The
+.Xr getopt 1
+manual page of
+.Fx
+reads,
+.Do
+Arguments containing white space
+or embedded shell metacharacters
+generally will not survive intact;
+this looks easy to fix but isn't.
+.Dc
+Yet here we are.