#! /Bin/sh and $ bash

Source: Internet
Author: User

#! /Bin/sh and $ bash #! /Bin/sh indicates that the script is interpreted and executed using/bin/sh ,#! Is a special identifier, followed by the path of the shell that explains the script. Www.2cto.com $ bash $ indicates the system prompt, $ indicates that this user is a common user, and the super user's prompt is #. Bash is a shell and the most common shell in linux. $ Bash refers to executing a subshell, Which Is bash. Note that "#! ", Which means that you need to specify an interpreter for executing the system file .#! It is actually a 2-byte [1] magic number, which specifies a special mark of the file type, in other words, in this case, it refers to an executable script (type man magic to get more details about this fascinating topic ). www.2cto.com on #! Followed by a path name. this path name specifies a program that interprets commands in the script. This program can be a shell, program language, or any common program. this specified program starts from the beginning and executes the commands in the script (from #! At the beginning of the line), ignore the comment. [2] For example: 1 #! /Bin/sh 2 #! /Bin/bash 3 #! /Usr/bin/perl 4 #! /Usr/bin/tcl 5 #! /Bin/sed-f 6 #! /Usr/awk-f Note :#! The path name provided later must be correct. Otherwise, an error message is displayed, usually "Command not found", which is the only result you get when running this script. if there is another # in the script #! Line, bash will regard it as a normal comment line.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.