Differences between revisions 12 and 29 (spanning 17 versions)
Revision 12 as of 2008-02-05 08:50:25
Size: 691
Editor: PeMac
Comment:
Revision 29 as of 2021-03-27 03:06:15
Size: 1755
Editor: PaulWise
Comment: cleanups
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## Auto-converted by kwiki2moinmoin v2005-10-07
["Shell"]>["Bash"]
-------
ShellScript is a ["Script"] written for the ["Shell"] (["Bash"]). They are similar to *.bat files in Windows.
##language en
Line 6: Line 3:
The ["MIME"] type is application/x-shellscript ||<tablestyle="width: 100%;" style="border: 0px hidden">~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[it/ShellScript|Italiano]]-~||<style="text-align: right;border: 0px hidden"> (!) [[/Discussion|Discussion]]||
----
Line 8: Line 6:
They are text files which first line says the shell to use (bash). So the first line is A '''[[WikiPedia:Shell_script|Shell script]]''' is a script written for and to be interpreted by a [[Shell]]. Shell scripts use ShellCommands and a specific syntax. Operations performed by shell scripts include file manipulation, program execution, and printing text.
Line 10: Line 8:
A script is a text file, which ''may or may not'' have the file extension {{{.sh}}}. Other file extensions may also be used, e. g. {{{.bash}}} or {{{.zsh}}}, but this has no effect on the script’s functionality. They are just used to inform a human user about the syntax used in the script or to tell an editor program which syntax highlighting it should use.

The first line of the file begins with the so called [[https://en.wikipedia.org/wiki/Shebang_(Unix)|shebang]] ({{{#!}}}) followed be the path to the shell to interpret and execute the rest of the script:

For scripts using [[https://en.wikipedia.org/wiki/POSIX|POSIX]] syntax:

{{{#!text
#!/bin/sh
}}}

For scripts using Bash syntax:

{{{#!text
Line 11: Line 22:
}}}
Line 12: Line 24:
After this, you can include comments using # in the beginning of the line. For example: The [[MIME]] type of shell scripts is nowadays {{{text/x-shellscript}}} but other systems may still use {{{application/x-shellscript}}}. As the MIME type depends on the system’s configuration, other MIME types may be used, even {{{text/plain}}}.
Line 14: Line 26:
#This is a comment.

/bin/sh is its interpreter.


Finally, see the ["Bash"] commands.
On Microsoft Windows {{{.bat}}} or {{{.cmd}}} files play a similar role but have a different syntax.
Line 22: Line 29:
* [http://steve-parker.org/sh/sh.shtml Linux Shell Scripting Tutorial].
* [http://www.zazzybob.com/bin.html Shell Script Repository].

 * https://www.shellscript.sh/ - Linux Shell Scripting Tutorial

-----
CategoryCommandLineInterface

Translation(s): English - Italiano

(!) ?Discussion


A Shell script is a script written for and to be interpreted by a Shell. Shell scripts use ShellCommands and a specific syntax. Operations performed by shell scripts include file manipulation, program execution, and printing text.

A script is a text file, which may or may not have the file extension .sh. Other file extensions may also be used, e. g. .bash or .zsh, but this has no effect on the script’s functionality. They are just used to inform a human user about the syntax used in the script or to tell an editor program which syntax highlighting it should use.

The first line of the file begins with the so called shebang (#!) followed be the path to the shell to interpret and execute the rest of the script:

For scripts using POSIX syntax:

#!/bin/sh

For scripts using Bash syntax:

#!/bin/bash

The MIME type of shell scripts is nowadays text/x-shellscript but other systems may still use application/x-shellscript. As the MIME type depends on the system’s configuration, other MIME types may be used, even text/plain.

On Microsoft Windows .bat or .cmd files play a similar role but have a different syntax.


CategoryCommandLineInterface