# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 9
# self = https://watcher.sour.is/conv/oxbrzjq
And errors out expectedly using dash or ash, very nice POSIX Sh compliant shells:


$ ./foo.sh
./foo.sh: line 5: [: bar: integer expression expected


So the lessons here are twofold:

- Always use shellcheck to check your shell code
- Never use Bash or rely on Bash(isms). Always prefer POSIX Sh
And errors out expectedly using dash or ash, very nice POSIX Sh compliant shells:


$ ./foo.sh
./foo.sh: line 5: [: bar: integer expression expected


So the lessons here are twofold:

- Always use shellcheck to check your shell code
- Never use Bash or rely on Bash(isms). Always prefer POSIX Sh
@prologic Yeah, that is part of the problem. Bash is so dominant on Linux, it’s hard to avoid. When I use #!/bin/sh, it still gets me a Bash that does NOT enter strict POSIX mode. 🫤 The script below uses Bashisms and requests #!/bin/sh but still runs happily …

#!/bin/sh

foo=1

if [[ "$foo" == 1 ]]
then
echo match
fi=
@prologic Yeah, that is part of the problem. Bash is so dominant on Linux, it’s hard to avoid. When I use #!/bin/sh, it still gets me a Bash that does NOT enter strict POSIX mode. 🫤 The script below uses Bashisms and requests #!/bin/sh but still runs happily …

#!/bin/sh

foo=1

if \n]
then
echo match
fi=
@prologic Yeah, that is part of the problem. Bash is so dominant on Linux, it’s hard to avoid. When I use #!/bin/sh, it still gets me a Bash that does NOT enter strict POSIX mode. 🫤 The script below uses Bashisms and requests #!/bin/sh but still runs happily …

#!/bin/sh

foo=1

if [[ "$foo" == 1 ]]
then
echo match
fi=
@prologic Yeah, that is part of the problem. Bash is so dominant on Linux, it’s hard to avoid. When I use #!/bin/sh, it still gets me a Bash that does NOT enter strict POSIX mode. 🫤 The script below uses Bashisms and requests #!/bin/sh but still runs happily …

#!/bin/sh

foo=1

if [[ "$foo" == 1 ]]
then
echo match
fi=
@prologic Yeah, that is part of the problem. Bash is so dominant on Linux, it’s hard to avoid. When I use #!/bin/sh, it still gets me a Bash that does NOT enter strict POSIX mode. 🫤 The script below uses Bashisms and requests #!/bin/sh but still runs happily …

#!/bin/sh

foo=1

if [[ "$foo" == 1 ]]
then
echo match
fi=
@movq Yes I feel your pain 🙄
@movq Yes I feel your pain 🙄