Linux下如何执行Shell脚本
2016-06-29 17:03
627 查看
Linux下你可以有两种方式执行Shell脚本:
注意:本文转载自: Linux下如何执行Shell脚本
1、用shell程序执行脚本:根据你的shell脚本的类型,选择shell程序,常用的有sh,bash,tcsh等(一般来说第一行#!/bin/bash里面指明了shell类型的,比如#!/bin/bash指明是bash,#!/bin/sh则是sh);然后输入命令(其中bash为shell的名称,myshell.sh则为你要执行的代码):
bash myshell.sh
2、直接执行脚本:
不过首先的加上可执行权限(也许要root权限,4情况而定),执行:
chmod +x myshell.sh
然后执行:
./myshell.sh
就可以执行了。
注意:本文转载自: Linux下如何执行Shell脚本
1、用shell程序执行脚本:根据你的shell脚本的类型,选择shell程序,常用的有sh,bash,tcsh等(一般来说第一行#!/bin/bash里面指明了shell类型的,比如#!/bin/bash指明是bash,#!/bin/sh则是sh);然后输入命令(其中bash为shell的名称,myshell.sh则为你要执行的代码):
bash myshell.sh
2、直接执行脚本:
不过首先的加上可执行权限(也许要root权限,4情况而定),执行:
chmod +x myshell.sh
然后执行:
./myshell.sh
就可以执行了。
相关文章推荐
- Linux socket 初步
- android wifi 无线调试
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- 动态清空 nohup 输出文件
- install scrapy with pip and easy_install
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)