1

while following this tutorial I found a command

#!/bin/sh
git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f

I don't understand the meaning of #!/bin/sh. I tried to search it but google removes the ! symbol from search results.

What does #!/bin/sh mean here? Please help.

1615903
  • 32,635
  • 12
  • 70
  • 99
Ramesh Pareek
  • 1,601
  • 3
  • 30
  • 55
  • http://askubuntu.com/questions/141928/what-is-difference-between-bin-sh-and-bin-bash – Tim Biegeleisen Mar 23 '17 at 09:30
  • 2
    It is a convention specifying which shell program should interpret the rest of the file. – Lasse V. Karlsen Mar 23 '17 at 09:30
  • Attention Downvoter! Can you help me understand I could get an answer to my question? Can you help me understand what is the better way to ask this question? If not, you are just promoting ignorance... so that the ignorant remain ignorant as if they don't have the right to know what they don't know. – Ramesh Pareek Mar 23 '17 at 09:37

1 Answers1

3

#! specifies the program with which the script should be executed if you not explicitly call it which any

in your case, if you call your script with: <scriptname.sh> Linux will execute it as /bin/sh <scriptname.sh>

Jens
  • 67,715
  • 15
  • 98
  • 113