您的位置:首页 > 运维架构 > Shell

初识shell脚本

2016-12-11 20:31 183 查看
vim test.sh

#!/bin/bash
echo "Hello World !"


#!” 是一个约定的标记,它告诉系统这个脚本需要什么解释器来执行,即使用哪一种Shell。

chmod +x test.sh #使脚本具有执行权限
./test.sh #执行脚本,在当前目录找,第一行必须是#!/bin/bash
/bin/sh test.sh #执行脚本,在当前目录找,不需要在第一行指定解释器信息#!/bin/bash

vim test1.sh

#!/bin/bash
# Author : wx
# Date :
echo "What tools are you using?"
read tool
echo "Hello, $tool"


  

$ sh /home/wx/test1.sh
What tools are you using?
shell
Hello, shell
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: