Bash Commands - chmod # Invoking script
来源:互联网 发布:网络歌曲男人伤感情歌 编辑:程序博客网 时间:2024/06/05 22:33
1. Invoke
Having written the script, you can invoke it by bash scriptname.
Much more convenient is to make the script itself directly executable with a chmod.
$ chmod 555 scriptname (gives everyone read/execute permission) or
$ chmod +rx scriptname (gives everyone read/execute permission)
2. Test
Having made the script executable, you may now test it by
./scriptname
For example:
$ cat >test_chmod << "EOF" # Create a (script) file named test_chmod.
> #!/bin/bash # the "sha-bang" line. Indicate calling command interpreter.
> echo "Hello,bash world!" # Write a script command.
> EOF # End the file.
$ chmod 555 test_chmod # Invoke the script file, gives everyone read/execute permission.
$ ./test_chmod # test it!
Hello,bash world! # The script file was run.
3. "sha-bang" line
#!/bin/sh
#!/bin/bash
#!/usr/bin/perl
#!/usr/bin/tcl
#!/bin/sed -f
#!/bin/awk -f
Each of the above script header lines calls a different command interpreter, be it /bin/sh, the default shell
(bash in a Linux system) or otherwise.
Note: $chmod 4755 filename # Give filename root permission.
- Bash Commands - chmod # Invoking script
- Bash Commands - Create a script with multi-parameter
- Bash Script
- VERSION { version-script-commands }
- Bash Commands - Special Charactors # ? $
- Bash Commands - $ # Variable Substitution
- Bash Commands - Comparison Operators
- Bash Commands - tr cat tac
- Bash Commands - # Integer or string?
- Bash Commands - Arithmetic Tests using (( ... ))
- Bash Commands - File test operators
- running bash commands in python
- Learn BASH -- Grouping Commands(from bash manual)
- shell script - BASH
- Shell Script(bash)简介
- Linux Bash Script
- Bash Self-Extracting Script
- linux bash script
- 判断GPS坐标是否在中国
- SVN的安装配置 以及与MyEclipse 整合使用开发
- How to pass parameters from a screen to another screen--lightswitch
- 数组初始化的区别
- andriod开发 1:android在Linux下的环境配置以及编译设置介绍
- Bash Commands - chmod # Invoking script
- 设置VS代码折叠
- javascript中文比较方法——localeCompare() 方法
- 算法导论1.1
- VoIP基本概念:H.323协议简介
- POJ-1204-Word Puzzles
- Bellman-Ford 算法实现单源最短路径
- Android 判断Webview 的水平滚动
- IT程序员不得不知道的程序出现的错误类型