jirutka / esh

Simple templating engine based on shell.
MIT License
214 stars 16 forks source link

Conditional #9

Closed simon-zumbrunnen closed 4 years ago

simon-zumbrunnen commented 4 years ago

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 commented 4 years ago

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

simon-zumbrunnen commented 4 years ago

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

jirutka commented 4 years ago

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.