murex Shell Docs

Command Reference: g

Glob pattern matching for file system objects (eg *.txt)


Returns a list of files and directories that match a glob pattern.

Output is a JSON list.


g: pattern -> <stdout>


# inline globbing
cat: @{ g: *.txt }

# writing a JSON array of files to disk
g: *.txt -> > filelist.json

# writing a list of files to disk
g: *.txt -> format str -> > filelist.txt

# checking if a file exists
if { g: somefile.txt } then {
    # file exists

# checking if a file does not exist
!if { g: somefile.txt } then {
    # file does not exist


Pattern reference


Any command prefixed with @g will be auto-globbed. For example, the two following commands will produce the same output:

» ls @{g: *.go}
benchmarks_test.go  defaults_test.go  flags.go  godoc.go  main.go  murex_test.go

» @g ls *.go
benchmarks_test.go  defaults_test.go  flags.go  godoc.go  main.go  murex_test.go

The rational behind the ugly @g syntax is simply to make one-liners a bit less painful when coming from more traditional POSIX-like shells (eg Bash) where wildcards are automatically expanded. So if you type ls * (for example) then realise you've forgotten to subshell, you can just recall the last command with auto-globbing enabled:

@g ^!!


See Also

This site is rebuilt weekly, the content is automatically generated from murex's source code. Last built on Mon Sep 21 06:11:30 UTC 2020 against commit 2557f7c2557f7cc7535c452c21d89164bd38ed8996f02fd. Downloadable murex binaries are also built weekly. Current version is 0.52.2000 BETA which has been verified against tests.