./test.sh: 4: [: Linux: unexpected operator
!/bin/sh
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then echo "Script running under GNU/Linux"
bash
with dash
since Ubuntu 6, you can see with ls -l /bin
you will see sh -> dash
. Use #!/bin/bash
instead of #!/bin/sh
, or use =
instead of ==
when comparing two strings.