Closed dinwiggy closed 1 month ago
What OS did you run this on ?
Changing line 1 to /usr/bin/env bash
could possibly make tcpping fail on FreeBSD, need to investigate.
I honestly don't remember. I would guess smokeping on a recent version of either raspbian or ubuntu. The only problem was the use of ==
on line 341. Dash is apparently the worst but not only offender: https://unix.stackexchange.com/a/382012
Bash isn't providing any features here, so there's not a need to use it, and like you said there's potential issues with forcing it. I only gave that as one of the ways I resolved it to be thorough. For cross-shell compatibility, avoiding bashisms seems preferable anyway.
Hi,
Same behavior on ubuntu 20.10. ==
is not a valid operator on this dash
version.
alice@bob:~/src$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.10
Release: 20.10
Codename: groovy
alice@bob:~/src$ which sh
/usr/bin/sh
alice@bob:~/src$ ls -l /usr/bin/sh
lrwxrwxrwx 1 root root 4 mars 30 2020 /usr/bin/sh -> dash
alice@bob:~/src$ apt-cache policy dash
dash:
Installed: 0.5.10.2-7
Candidate: 0.5.10.2-7
Version table:
*** 0.5.10.2-7 500
500 http://fr.archive.ubuntu.com/ubuntu groovy/main amd64 Packages
100 /var/lib/dpkg/status
alice@bob:~/src$ dash
$ test "a" == "b"
dash: 1: test: a: unexpected operator
$ test "a" = "b"
$ echo $?
1
$
Retested against bash, dash and zsh.
Working fixes:
=
instead of==
./bin/bash
.checkbashisms
reports possible issues on lines 75, 160, 165, 341.