赞
踩
运行shell脚本文件,需要使用到"Git Bash"软件 ,所以得有一个git 环境 官网下载地址Git - Downloads, 我们选择 Windows 版本
在系统变量中找到Path,将git安装目录下的bin(我的安装路径:D:\Program Files\Git\bin)添加到Path环境变量中,注意路径前如果没有分号,记得要加上分号;如下图所示:
配置Path环境变量
环境变量设置成功。我们来检验一下是否安装成功? 在任意目录下,单击鼠标右键,可以看到Git Bash Here,点击此选项,打开git bash命令行
打开 git bash 界面,输入 git version ,如果显示有安装版本号,则表示安装成功
在刚打开的git bash 界面中操作,各种常规的Linux命令可以直接用
- # 1. 新建一个test.sh 文件
- touch test.sh
-
- # 2. 编辑test.sh 并输出一个“hello world”字符串
- vim test.sh
-
- 编辑输入代码
- echo "hello world"
-
-
- sh test.sh
- 打印输出:
-
- hello world
Windows环境下有三种运行脚本的方式:
(1)./test.sh
(2)sh test.sh
(3)/bin/sh test.sh
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。