Sunday, December 3, 2023

Implementing a stack in bash

I needed to convert simplified HTML to wiki markup. For that I first needed to check the syntax of the HTML. A stack is perfect for that, but how to do it?

declare -a stack
# push
stack+=($tag)
#pop
unset stack[${#stack[@]}-1]

And that is all there is to it.

No comments:

Post a Comment