I have this git script, which gives me the output i need for a python program i'm using it in. The problem is, the script doesn't work on the Debian 7 Machine, where i need to use it on. It does however work without a problem on my Manjaro PC.#!/bin/bashbranch=$1if [[ -n $branch ]]; thenformat=Author:%x09%anformat+=%x0aDate:%x09%adformat+=%x0aRefs:%x09%dformat+=%x0a%x0a'%w(,4)%s'format+=%x0a%x0a'%w(,4,4)%b'git rev-list --pretty=$format $branchelse    echo argument errorfiWhen i type the commands by myself it's also working.Can somebody help me with this? Edit:The first error i get is about the 2 [[. If i change it to if [ -n $branch ]; then it proceeds to the format declarations, where i get a no found error on every line. The git rev-list command however works but fails due to no argument.Edit 2: Executing the script through bash [script] instead of sh [script] solved the problem! I'm still wondering though why it worked on my Manajaro machine with sh.
Command working in shell but not in script
shell script;debian;shell
The sh shell on your Manjaro installation may be dash, which does not understand the [[ ... ]] syntax, nor does it understand the += syntax used to append to the value of a variable.This would explain why those particular lines in the script fails to execute properly when the script is run with sh rather than with bash.To alleviate this, make sure that the hash-bang line (#!) points to the correct path of bash, and make the script executable with chmod +x scriptname.sh.  This way you may run the script with e.g. ./scriptname.sh without having to explicitly tell it to use bash.