github.com/mithrandie/csvq@v1.18.1/docs/_posts/2006-01-02-external-command.md (about)

     1  ---
     2  layout: default
     3  title: External Command - Reference Manual - csvq
     4  category: reference
     5  ---
     6  
     7  # External Command
     8  
     9  You can run an external command by placing a Dollar Sign(U+0024 `$`) at the beggining of the line.
    10  The result is written to the standard output.
    11  
    12  [CALL Function]({{ '/reference/system-functions.html#call' | relative_url }}) also runs an external command, but the result is returned as a string.
    13  
    14  ```
    15  $ command [args ...]
    16  ```
    17  
    18  Arguments are separated with spaces. 
    19  Strings including spaces are treated as a single string by enclosing in Apostrophes(U+0027 `'`) or Quotation Marks(U+0022 `"`).
    20  Embedded expressions including spaces are also treated as chunks. 
    21    
    22  In the arguments, following expressions can be embedded.
    23  
    24  * [Variable]({{ '/reference/variable.html' | relative_url }})
    25  * [Environment Variable]({{ '/reference/environment-variable.html' | relative_url }})
    26  * [Runtime Information]({{ '/reference/runtime-information.html' | relative_url }})
    27  * Embedded Expression written in the following format
    28  
    29  ## Embedded Expression
    30  {: #embedded-expression}
    31  
    32  ```
    33  ${value_expression}
    34  ```
    35  
    36  Expressions can be embedded in arguments by enclosing in a Dollar Sign(U+0024 `$`) and Curly Brackets(U+007B, U+007D `{}`).
    37  The result of evaluation of the expression must be a single [value]({{ '/reference/value.html' | relative_url }}).
    38  
    39  
    40  ### Examples
    41  ```bash
    42  csvq > $echo 'abc'
    43  abc
    44  csvq > VAR @ARG := 'argstr'
    45  csvq > $echo @ARG
    46  argstr
    47  csvq > $echo @%HOME
    48  /home/mithrandie
    49  csvq > $echo ${@%HOME || '/docs'}
    50  /home/mithrandie/docs
    51  csvq > $sh -c 'echo ${@%HOME || "/docs"} | wc'
    52        1       1      22
    53  csvq >
    54  ```