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

For loop fails as script but works in the REPL #1840

Open
1 task done
sebastien opened this issue Sep 7, 2024 · 1 comment
Open
1 task done

For loop fails as script but works in the REPL #1840

sebastien opened this issue Sep 7, 2024 · 1 comment

Comments

@sebastien
Copy link

What happened, and what did you expect to happen?

When running the following script using elvish script.elv fails with the following error Exception: exec: "str:trim": executable file not found in $PATH. However, copy-pasting each line in the REPL works as expected.

Script:

var lines = [one two three]
for line $lines { echo (str:trim $line ' ') }

Using Elvish 0.21.0

Output of "elvish -version"

0.21.0

Code of Conduct

@hanche
Copy link
Contributor

hanche commented Sep 11, 2024

You have to include use str in your script.

You probably have that line in rc.elv, but elvish doesn't read the init files when executing a script. (To see what I mean, try your example in an interactive shell started as elvish -norc.)

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

2 participants