Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support read bultin for user input #5

Open
dundalek opened this issue Jun 8, 2023 · 0 comments
Open

Support read bultin for user input #5

dundalek opened this issue Jun 8, 2023 · 0 comments

Comments

@dundalek
Copy link

dundalek commented Jun 8, 2023

When wanting to read user input with:

echo -n "Your name: "
read name
echo Hello "$name"

Gets translated as following which does not work because read is a shell builtin and cannot be executed:

(require (quote [babashka.process :refer [shell pipeline pb]]))
(def name (System/getenv "name"))
(shell "echo" "-n" "Your name: ")
(shell "read" "name")
(shell "echo" "Hello" name)

We could translate it as (read) and introduce a binding which would make it work:

(require (quote [babashka.process :refer [shell pipeline pb]]))
(shell "echo" "-n" "Your name: ")
(def name (read))
(shell "echo" "Hello" name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant