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

Section 2.4, echo command doesn't work in zsh #151

Open
JADekker opened this issue Feb 21, 2024 · 2 comments
Open

Section 2.4, echo command doesn't work in zsh #151

JADekker opened this issue Feb 21, 2024 · 2 comments

Comments

@JADekker
Copy link

JADekker commented Feb 21, 2024

Please quote the text that is incorrect:

echo "It works!" | ./build/bin/feline

In what way is this incorrect?

This works in bash, but in VS Code, the default has now become zsh, which yields an error (because of an interplay between the double quote and the !). Some possible fixes:

echo "It works" | ./build/bin/feline
echo ""It works!"" | ./build/bin/feline
echo 'It works!' | ./build/bin/feline
@david-christiansen
Copy link
Collaborator

Thanks for the report! I'll look into this on the next round of revisions to the book.

It does strike me as odd that the editor would be picking the shell, though - isn't the shell selected by your user setup? My understanding is that Mac OS replaced its default shell with zsh a couple of years ago - are you on a Mac?

This kind of thing is also an issue for other shells that are less compatible with sh, like fish and the various Windows ones (this example works in fish, but others may not). I'll think about just rewriting the section to do I/O from a file instead of using echo, which should be more portable if a bit less punchy.

@JADekker
Copy link
Author

JADekker commented Feb 21, 2024

Thank you! What I meant is that VS Code tells me "The default interactive shell is now zsh" when I select bash, which I originally interpreted as a message from VS Code. I'm on Mac and inspecting further, it seems to be the case that this is due to it being the Mac default indeed!

Having more portable instructions would certainly be nice (especially for people like me who know hardly any shell commands)!

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