在Shell脚本的执行过程中,Shell脚本支持调用另一个Shell脚本,调用的格式为:程序名 实例:在Shell脚本test1中调用test2. 1.调用test2#test1脚本root@ubuntu:/home/study# vi test1; #!/bin/bash echo "The main name is $0"; ./test2; echo "The first string is $1"; #test2脚本root@ubuntu:/home
有时候想对本地的几个repository都进行一下pull,一个一个操作比较繁琐,所以写了个shell脚本进行简化操作. git_pull_all.sh #!/bin/sh clear function showMsg() { echo -e "\033[32m$1\033[0m" } lstRepo=( Project01 Project02 Project03 Project04 ) for repo in ${lstRepo[@]} do cd ../$repo showMsg
情况如下: 我在ubuntu server 14.04 上面安装了gitlab,来托管项目代码.然后想通过gitlab的web hook 功能来做测试服务器代码自动化更新代码功能.现在遇到一个问题:就是我客户端在master分支上面push代码的时候,我测试服务器的代码目录并没有自动更新.我的shell脚本如下: !/bin/bash echo 'haha:::==' >> /tmp/wtz.log cd /srv/www/bfar-ng echo 'my name is gitlab'>
功能说明:用root用户执行一个脚本,脚本里需要切换到普通用户DT去执行其他命令,其中就用到了EOF,用法如下: #!/bin/bash su - DT<<EOF cd apache-tomcat-7.0.54/bin sh startup.sh EOF 当时以为su - DT就跟在交换界面执行一样会把环境也切换过去,所以在分界符EOF里用的是相对路径,结果一运行就报错: -bash: line 8: cd: apache-tomcat-7.0.54/bin: 没有那个文件或目录 然后就做了个
查询员工信息 -S:静默登录 [oracle@localhost shells]$ cat shell1.sh #!/bin/bash #查询员工信息 sqlplus -S /nolog <<EOF conn scott/scott set feedback off set linesize 300 set pagesize 100 col empno for 99999 col ename for a12 col mgr for 9999 col hiredate for a20 col c