I've just found out that getopt
is not cross-platform (in particular for FreeBSD and Linux). What is the best workaround for this issue?
views:
119answers:
2
A:
Basic syntax for getopt
is cross-platform.
getopt vi: -v -i 100 file
codeholic
2010-04-28 09:14:01
+2
A:
Use getopts
(with an "s").
According to Bash FAQ 35:
Never use getopt(1). getopt cannot handle empty arguments strings, or arguments with embedded whitespace. Please forget that it ever existed.
The POSIX shell (and others) offer getopts which is safe to use instead.
Dennis Williamson
2010-04-28 10:30:31