by chubot · 6y ago · 0 comments
- You can write @ARGV instead of "$@".
- You can write @myarray instead of "${myarray[@]}"
(Related: Thirteen Incorrect Ways and Two Awkward Ways to Use Arrays https://www.oilshell.org/blog/2016/11/06.html )
Example:
oil$ var myarray = @('has spaces' foo)
oil$ var s = $'has\ttabs'
# function to print an array element on each line
oil$ lines() { for x in @ARGV; do echo $x; done }
# pass 3 args -- 2 from myarray and 1 from s
oil$ lines @myarray $s
has spaces
foo
has tabs
[1] https://www.oilshell.org/As I see it, the goal for a project like Oilshell (a shell with both a new syntax and support for standard bash syntax) would be to replace bash as the default shell in distros. Until then, Oil scripts lack the primary feature of bash scripts just like other alternative shells.
Right, that's the goal of Oil.