From 9460942a7672757e7859ee5e4746bf940becb274 Mon Sep 17 00:00:00 2001 From: duzhijian Date: Tue, 30 Aug 2016 14:59:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.swp" | Bin 0 -> 12288 bytes .../demo1.sh" | 28 +++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 "shell\345\255\246\344\271\2401-\345\270\270\347\224\250\345\221\275\344\273\244/.swp" diff --git "a/shell\345\255\246\344\271\2401-\345\270\270\347\224\250\345\221\275\344\273\244/.swp" "b/shell\345\255\246\344\271\2401-\345\270\270\347\224\250\345\221\275\344\273\244/.swp" new file mode 100644 index 0000000000000000000000000000000000000000..6bc52c7e452d499f4b63644fd76322ac13ef947a GIT binary patch literal 12288 zcmeI%Jr05}6u|L^8U0ghs=kX}es*DW@12FuXv`w47 zzL($DH1Tei&^aFiQEj7#U%S3V(#JC|$|A1%O~ahjSv_>d5Xv?J2uvnmN5RSWbUOF2 zcXr!ovdknx009ILKmY**5I_Kd`33HcB`;OR>R*awnCGvQ3J^d50R#|0009ILKmY** v5I|t8K%9zv)*`Ly`v1Rw|9{tGFC`8E1Q0*~0R#|0009ILKmY**7A4RD<)09i literal 0 HcmV?d00001 diff --git "a/shell\345\255\246\344\271\2401-\345\270\270\347\224\250\345\221\275\344\273\244/demo1.sh" "b/shell\345\255\246\344\271\2401-\345\270\270\347\224\250\345\221\275\344\273\244/demo1.sh" index b94cf93..c436972 100755 --- "a/shell\345\255\246\344\271\2401-\345\270\270\347\224\250\345\221\275\344\273\244/demo1.sh" +++ "b/shell\345\255\246\344\271\2401-\345\270\270\347\224\250\345\221\275\344\273\244/demo1.sh" @@ -1,3 +1,29 @@ #!/bin/bash -echo "hello word !" \ No newline at end of file +echo " +运行Shell脚本有两种方法: +1、作为可执行程序 +先cd到相应目录: +chmod +x ./test.sh #使脚本具有执行权限 +./test.sh #执行脚本 +注意,一定要写成./test.sh,而不是test.sh,运行其它二进制的程序也一样,直接写test.sh,linux系统会去PATH里寻找有没有叫test.sh的,而只有/bin, /sbin, /usr/bin,/usr/sbin等在PATH里,你的当前目录通常不在PATH里,所以写成test.sh是会找不到命令的,要用./test.sh告诉系统说,就在当前目录找。 +2、作为解释器参数 +这种运行方式是,直接运行解释器,其参数就是shell脚本的文件名,如: +/bin/sh test.sh +/bin/php test.php +这种方式运行的脚本,不需要在第一行指定解释器信息,写了也没用。 +" + + +:<