Snap Install hook, sh or bash?

Hi everyone, I’m experiencing a problem in the installation phase of a snap. I have an install hook like this:

#!/bin/bash

echo "{
\"example\":\"hello\",
}" >> "$SNAP_DATA/config.json"

everytime I run the snap installation script I get some errors regarding the shabang part. If I change it to #!/bin/sh works, but the next time I try to install the snap it doesn’t work anymore and I have to get back to #!/bin/bash. The next time I have to get back to #!/bin/sh and so on. Every time! It’s a very strange error and I cannot understand what is the problem.

Any suggestions?

1 Like

If anyone runs into this error I solved it by doing a dos2unix conversion.

1 Like