Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

实现解析函数ParseOpts:支持选项的值是数组 #17

Closed
oldratlee opened this issue Jul 14, 2013 · 0 comments
Closed

实现解析函数ParseOpts:支持选项的值是数组 #17

oldratlee opened this issue Jul 14, 2013 · 0 comments
Assignees
Labels

Comments

@oldratlee
Copy link
Owner

选项的值是数组。find命令的-exec选项即是数组类型的:

find . -exec echo -e {} \;

上面Case的-exec的值是 echo -e {},包含了3个元素。

实际上这个选项可以多次指定:

find . -exec echo "find file:" \; -exec echo -e {} \; 

测试Case

  • 没有参数:
    parsh.sh
  • 长短选项都能读到的值,且一样:
    echo "$_OPT_VALUE_a $_OPT_VALUE_a_long"
  • 支持不同位置的参数,开头、中间、--之后:
    ./parse.sh 00 -a -c c.sh a b \; -b x aa bb cc -- dd ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant