running sh scripts through shellcheck

Rowland Penny rpenny at samba.org
Fri Aug 11 09:45:58 UTC 2017


On Fri, 11 Aug 2017 09:20:33 +0100
Rowland Penny via samba-technical <samba-technical at lists.samba.org>
wrote:

> 
> OK, I have got to ctdb/tests/complex/30_nfs_tickle_killtcp.sh where I
> have found this:
> 
> echo "Getting MAC address associated with ${test_ip}..."
> releasing_mac=$(ip neigh show "$test_prefix" | awk '$4 ==
> "lladdr" {print $5}') [ -n "$releasing_mac" ] || die "Couldn't get
> MAC address for ${test_prefix}" echo "MAC address is:
> ${releasing_mac}"
> 
> So, who doesn't know that 'die' is a perl thing ?
> 
> There doesn't seem to be a 'die' function.
> 
> The script is also a 'bash' script instead of a 'sh' script.
> 
> Rowland
> 


Forget it, found 'die' in ctdb/tests/scripts/common.sh, still think
calling it 'die' was a bad idea though

It still shouldn't be a 'bash' script, it isn't portable, which brings
me to ctdb/tests/complex/32_cifs_tickle.sh

Changing #!/bin/bash to #!/bin/sh causes this:

In ctdb/tests/complex/32_cifs_tickle.sh line 69:
if [ "${out/SRC: ${src_socket} /}" != "$out" ] ; then
      ^-- SC2039: #!/bin/sh was specified, but string replacement is not standard.

I will have to find the relevant code, decipher it and re-write it for
'sh'

Rowland
 



More information about the samba-technical mailing list