1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-01 20:15:23 +02:00
tldr/pages/common/bb.md

21 lines
508 B
Markdown
Raw Normal View History

2022-11-18 02:52:38 +01:00
# bb
> Native Clojure interpreter for scripting.
> More information: <https://book.babashka.org/#usage>.
- Evaluate an expression:
2022-11-18 02:52:38 +01:00
`bb {{[-e|--eval]}} "(+ 1 2 3)"`
2022-11-18 02:52:38 +01:00
- Evaluate a script file:
2022-11-18 02:52:38 +01:00
`bb {{[-f|--file]}} {{path/to/script.clj}}`
2022-11-18 02:52:38 +01:00
- Bind [i]nput to a sequence of lines from `stdin`:
2022-11-18 02:52:38 +01:00
`printf "first\nsecond" | bb -i "(map clojure.string/capitalize *input*)"`
- Bind [I]nput to a sequence of EDN (Extensible Data Notation) values from `stdin`:
2022-11-18 02:52:38 +01:00
`echo "{:key 'val}" | bb -I "(:key (first *input*))"`