Forrest logo
back to the echo tool

bb:tldr:cee23

bb: Bind input to a sequence of EDN(Extensible Data Notation) values from stdin.
$ echo "{:key 'val}" | bb -I "(:key (first *input*))"
try on your machine

The command echo "{:key 'val}" | bb -I "(:key (first *input*))" consists of two parts connected by a pipe |.

  1. echo "{:key 'val}":

    • The echo command is used to print the given string or value.
    • In this case, the string being echoed is "{:key 'val}", which represents a Clojure map with a single key-value pair. The key is :key, and the value is the symbol 'val.
  2. bb -I "(:key (first *input*))":

    • bb is a command-line utility for working with Clojure code from the command line.
    • The -I flag specifies an expression to evaluate using bb.
    • In this case, the expression being evaluated is (:key (first *input*)). This expression takes the first element of the input provided to bb, and then accesses the value associated with the :key key in that element.
    • The input is obtained from the echo command through the pipe |. So, the output from echo (i.e., "{:key 'val}") is used as the input for bb.
    • The output of bb will be the value associated with the :key key in the input map. In this case, it will be the symbol 'val.
This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the echo tool