shell脚本的#!
来源:互联网 发布:开淘宝店能挣钱吗 编辑:程序博客网 时间:2024/06/05 17:29
摘自shell FAQ
#! 我不是注释,我是引用解释。
A1:bash脚本开始总少不了一句
- #! /bin/bash
参考( Mendel Cooper 的 Advanced Bash Scripting Guide ,第一章第二部分 Chapter 2. Starting Off With a Sha-Bang
The sha-bang ( #!) [1] at the head of a script tells your system that this file is a set of commands to be fed to the command interpreter indicated. The #! is actually a two-byte [2] magic number, a special marker that designates a file type, or in this case an executable shell script (type man magic for more details on this fascinating topic). Immediately following the sha-bang is a path name. This is the path to the program that interprets the commands in the script, whether it be a shell, a programming language, or a utility. This command interpreter then executes the commands in the script, starting at the top (the line following the sha-bang line), and ignoring comments. [3])
#!叫做Magic number(幻数、魔数。含义为当一个普通字符含有特殊意义时就叫幻数), #! 用来指定解释脚本的程序,可以是 Shell,也可以是其他程序。
- #!/bin/php
- #!/bin/expect
- #!/bin/perl
- ......
1) 如果shell脚本的第一个非空白字符不是“ #”,则它会使用Bourne shell。
2) 如果shell脚本的第一个非空白字符是“ #”,但不以“# !”开头时,则它会使用C shell。
3) 如果shell脚本以“# !”开头,则“ # !”后面所跟的字符串就是所使用的shell的绝对路径名。Bourne shell的路径名称为/bin/sh ,而C 外壳则为/bin/csh。
- 【shell脚本】shell的符号
- shell 脚本 与 shell 脚本的编写
- shell脚本:访问shell脚本的参数
- shell脚本的学习
- shell脚本的编写
- SHELL脚本的作用
- SHELL脚本的特性
- shell脚本的制作
- 简单的shell脚本
- 常用的shell脚本
- Shell的脚本编程
- shell的FTP脚本
- shell脚本的参数
- shell 脚本的使用
- shell 脚本的基础知识
- Shell脚本的运行
- 常用的shell脚本
- shell脚本的编写
- 利用xShell 与linux进行文件互传
- Foundation框架-NSString
- 6.9 Android 支付宝 开发者平台申请和接口调用
- ios类别和继承的区别
- 安卓第二夜 有趣的架构
- shell脚本的#!
- android顶部(toolbar)搜索框实现
- Qt 关于对象创建时parent的问题
- 安卓第三夜 概念漫游(上)
- OSI七层模型
- 输入名字或者地址可以下载论文
- POJ 3734 (快速幂)
- 119. Pascal's Triangle II
- 在类中delete自己会不会有问题??