I've created a stack interpreted script using Turtle and I want to be able to get the directory where the script is (regardless of where it's been called from).
This can be done in Bash by parsing $0
or $BASH_SOURCE[0]
(as described here, however, I can't work out how to do it with Stack/Turtle?
I've tried the FindBin library but it didn't work (it just returned the current working directory).
My script is currently defined like so:
#!/usr/bin/env stack
{- stack --resolver lts-13.3 script
--package turtle
--package text
-}
Is this possible with a stack script?