I tried to write a little program to list a non existing directory and echo done, in a .sh
file:
#!/bin/bash
ls notexist
echo 'done'
But my console outputs done on the first line, before the error message to list the nonexisting directory:
done
ls: notexist: No such file or directory
I don't think bash creates a thread automatically for each line of code, does it? I'm using terminal in macOS Big Sur.
Edit: I'm accessing terminal indirectly from the script
package of the Atom text editor in macOS Big Sur. The error goes away if I run code directly in console via ./file.sh
.