Re: bash scripts and files



2007/12/30, michael <cs@xxxxxxxxxxxxxxxxxxxxxxxxxxx>:
Folks, can somebody point me to an authorative reference that
explains when one needs to put, eg,
#!/bin/bash
as the first line of a script and whether or not it's required/
surplus/ignored for bash specific files such as .bashrc
and .bash_profile

many thanks but couldn't find it quickly using 'oogle. M

In a script that line specifies the interpreter to use to execute the
following lines on the script. It may be any interpreter that you
want: bash, sh, ksh, perl, python,etc..

In .bashrc, .bash_profile or other files that are "included" from
other interpreter/scripts you dont need the interpreter line.

As a note, if you are planning to write portable scripts, please use
#!/bin/sh and avoid "bashism" (like [ $foo -ge 1 ]) in the syntax.

Greetings


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: Need help with CGI/ DBI error (permissions?)
    ... >> Reason I'm asking is because even when I run the script from a command ... perl myscript ... > interpreter you specify in the shebang line is irrelevant. ... IIS server can't be too far off. ...
    (comp.lang.perl.misc)
  • Re: Leerzeichen in Dateinamen
    ... der OP es "kompatibel" haben will (zumindest steht in dem Script auf ... seiner Seite die /bin/sh als Interpreter). ... Stimmt, ich verwende in dem Script #!/bin/sh als Interpreter, da ich ... mir gar nicht erst extra die Bash installiere, ...
    (de.comp.os.unix.shell)
  • Re: A little help please?
    ... > the interpreter under Windows, preferably without the XP command prompt? ... Command Prompt and feed your script to perl, ...
    (perl.beginners)
  • Re: PHP in html
    ... additional calls to the server, ... to invoke a script handler for every single image. ... configuration of the webserver and the PHP interpreter. ... If you think interpreting all pages as PHP ...
    (comp.lang.php)
  • Re: Looking for advice: supporting multiple embedded interpreters
    ... > interpreter into a host application. ... > reimport a script that imports another script, ... When I need to run some code in that interpreter, I swap it ... > When I want to force a reload of all the script code in a given ...
    (comp.lang.python)