Skip to content
  • Jonathan Nieder's avatar
    remove #!interpreter line from shell libraries · 11d62145
    Jonathan Nieder authored
    In a shell snippet meant to be sourced by other shell scripts, an
    opening #! line does more harm than good.
    
    The harm:
    
     - When the shell library is sourced, the interpreter and options from
       the #! line are not used.  Specifying a particular shell can
       confuse the reader into thinking it is safe for the shell library
       to rely on idiosyncrasies of that shell.
    
     - Using #! instead of a plain comment drops a helpful visual clue
       that this is a shell library and not a self-contained script.
    
     - Tools such as lintian can use a #! line to tell when an
       installation script has failed by forgetting to set a script
       executable.  This check does not work if shell libraries also start
       with a #! line.
    
    The good:
    
     - Text editors notice the #! line and use it for syntax highlighting
       if you try to edit the installed scripts (without ".sh" suffix) in
       place.
    
    The use of the #! for file type detection is not needed because Git's
    shell libraries are meant...
    11d62145