11 Vote

Meaning of #!/bin/bash at the beginning of a file

Question by Guest | 2016-09-28 at 22:34

I got a bundle of files all having the string or term "#!/bin/bash" directly at their beginning.

Of course, those characters are just hieroglyphs for me. Nevertheless, I would really like to know what the meaning of those characters could be.

What kind of files are those? On Windows, they are just opening in the usual text editor.

ReplyPositiveNegative
0Best Answer0 Votes

Windows cannot do much with those files. Your files are namely so-called batch scripts for UNIX systems such as Linux or Mac OS X.

Using such batch scripts, you can automate computer tasks. In the question "What is a batch script" I have written an answer explaining what that means exactly in detail.

The meaning of "#!/bin/bash" is the following: The # at the beginning of the line indicates that this line is a comment. Therefore, the line will not be executed in the script. The "#!" (# and ! together) is called Shebang or Magic Line. On UNIX systems you can specify with this that the script should be executed using the specified program respectively interpreter (in this case /bin/bash). Instead Of "/bin/bash" you can also execute a script using another interpreter. For example "/bin/sh" or "/bin/dash". Each interpreter may have other supported functions, so that you can specify the application of your choice here depending on the task you want to do.

By the way, batch scripts can be edited using a normal text editor. Therefore, on Windows the Editor is used for opening. 
2016-09-29 at 17:11

ReplyPositive Negative
Reply

Related Topics

Rename File to its Folder Name

Tutorial | 0 Comments

PHP: File Download Script

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.