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

Conditional #9

Closed
simon-zumbrunnen opened this issue Nov 2, 2020 · 3 comments
Closed

Conditional #9

simon-zumbrunnen opened this issue Nov 2, 2020 · 3 comments

Comments

@simon-zumbrunnen
Copy link

From the examples I expect this to work:

<% if [ $TEST ]; then %>
This should be printed when TEST is not empty.
<% fi %>

But it doesn't. Am I doing something wrong?

@crownedgrouse
Copy link

If [ ! -z "$TEST" ] ; then

@simon-zumbrunnen
Copy link
Author

Thank you. 😊 This works. I don't understand why though. But I guess it has nothing to do with esh.

@jirutka
Copy link
Owner

jirutka commented Nov 3, 2020

That's unnecessary verbose, you can do if [ -n "$TEST"]; then or just if [ "$TEST"]; then. And yes, this is not related to esh, but shell.

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

3 participants