tdenniston / bish

Bish is a language that compiles to Bash. It's designed to give shell scripting a more comfortable and modern feel.
MIT License
1.48k stars 36 forks source link

Support file globbing #66

Open tdenniston opened 9 years ago

tdenniston commented 9 years ago

As discussed here: http://ubuntuforums.org/showthread.php?t=2274570

File globbing is considered one of the main benefits of shell scripts versus other scripting languages. Bish should support globbing as a first-class feature.

Example of how this might look:

for (f in *.txt) {
    println("Text file: $f")
}
egorsmkv commented 9 years ago

:+1:

Artoria2e5 commented 4 years ago

For now you can do with the "basically eval" @() syntax:

./bish /dev/fd/0 << 'EOF'
a=[1,2]
@(a=\(*.txt\))
b=a
println(b[2])
EOF

The first assignment on a is to fool the typecheck. The b=a assignment is to invalidate the constant a[2] == 2 transfer.