Aire-One/gstatus

sh vs bash vs other shells

cobacdavid opened this issue · 1 comments

Running script fails in my terminal running zsh:

$ gstatus              
/home/david/travail/david/production/info/scripts/gstatus: 34: function: not found
master
/home/david/travail/david/production/info/scripts/gstatus: 36: Syntax error: "}" unexpected

Nevertheless, it works fine in overiding shell:

$ zsh $(which gstatus) 
master  origin/master 
A  machines/routage/routage_statique.png
A  machines/socket/Makefile
A  machines/socket/auto/socket.el
A  machines/socket/client_serveur.png
A  machines/socket/socket.out
A  machines/socket/socket.pdf
A  machines/socket/socket.pytxcode
A  machines/socket/socket.tex
A  machines/socket/socket.tex~
A  machines/socket/socket.thm
A  machines/socket/socket_ex1.py
A  machines/socket/socket_ex1.py~
A  machines/socket/socket_ex2.py
A  machines/socket/socket_ex2.py~

This seems to be a POSIX-compliant issue with function as seen in this SO thread

I guess I should modify the shebang line in your script.

@cobacdavid There is still room for improvement (PR welcome 😄), but the script should be POSIX compliant now!