在Shell脚本的执行过程中,Shell脚本支持调用另一个Shell脚本,调用的格式为:程序名

实例:在Shell脚本test1中调用test2。

1、调用test2
#test1脚本
root@ubuntu:/home/study# vi test1;

  1. #!/bin/bash
  2.  
  3. echo "The main name is $0";
  4. ./test2;
  5. echo "The first string is $1";
 

#test2脚本
root@ubuntu:/home/study# vi test2;

  1. #! /bin/bash
  2.  
  3. echo "How are you $USER?";
 

root@ubuntu:/home/study# chmod +x test1;
root@ubuntu:/home/study# chmod +x test2;
root@ubuntu:/home/study# ./test1 ljq
The main name is ./test1
How are you root?
The first string is ljq
root@ubuntu:/home/study#

9、在Shell脚本中调用其他脚本的更多相关文章

  1. python脚本中调用其他脚本

    如果只关注脚本中调用他脚本直接看代码30行 PS:该脚本功能有:自动清理目录,创建目录,自动运行脚本,以此提升工作效率 import numpy as np import os from shutil ...

  2. shell脚本中调用其他脚本的三种方法

    方法一:使用 .     #. ./sub.sh 方法二:使用 source    #source ./sub.sh 方法三:使用 sh    #sh ./sub.sh 注意: 1.两个点之间,要有空 ...

  3. Linux/Unix shell 脚本中调用SQL,RMAN脚本

    Linux/Unix shell脚本中调用或执行SQL,RMAN 等为自动化作业以及多次反复执行提供了极大的便利,因此通过Linux/Unix shell来完成Oracle的相关工作,也是DBA必不可 ...

  4. shell脚本中调用另一个脚本的三种不同方法(fork, exec, source)

    fork ( /directory/script.sh) fork是最普通的, 就是直接在脚本里面用/directory/script.sh来调用script.sh这个脚本. 运行的时候开一个sub- ...

  5. Shell 脚本中调用另一个 Shell 脚本的三种方式

    主要以下有几种方式: Command Explanation fork 新开一个子 Shell 执行,子 Shell 可以从父 Shell 继承环境变量,但是子 Shell 中的环境变量不会带回给父 ...

  6. 如何在Python脚本中调用外部命令(就像在linux shell或Windows命令提示符下输入一样)

    如何在Python脚本中调用外部命令(就像在linux shell或Windows命令提示符下输入一样) python标准库中的subprocess可以解决这个问题. from subprocess ...

  7. 在shell脚本中调用另一个脚本的三种不同方法(fork, exec, source)——转载

    原文链接:http://blog.chinaunix.net/uid-22548820-id-3181798.html fork ( /directory/script.sh) :如果shell中包含 ...

  8. Shell脚本中调用另外一个脚本的方法

    (转载): 在Linux平台上开发,经常会在console(控制台)上执行另外一个脚本文件,经常用的方法有:./my.sh 或 source my.sh 或 . my.sh:这三种方法有什么不同呢?我 ...

  9. 013-在 Shell 脚本中调用另一个 Shell 脚本的三种方式

    如下: fork: 如果脚本有执行权限的话,path/to/foo.sh.如果没有,sh path/to/foo.sh. exec: exec path/to/foo.sh source: sourc ...

随机推荐

  1. speedbutton用法

  2. [转载].NET Web开发技术(补充)

    大家在工作应该养成善于总结的习惯,总结你所学习.使用的技术,总结你所工作事项的比较好的地方,善于总结不断的沉淀优化自己.适时停下来总结下过去走过的路,才能让我们的未来走的更坚定.文章转自JamesLi ...

  3. Win7 家庭普通版开启超级管理员

    将以下内容copy保存为admin.reg文件 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ ...

  4. Windows上编译libpng

    下载libpng 1.5.10并解压到[工作目录]/png/libpng-1.5.10 用CMake选择png/libpng-1.5.10目录并Configure: CMAKE_C_FLAGS_DEB ...

  5. mysql --initialize specified but the data directory has files in it

    删除 *.ini 文件中的datadir=“....”目录下的文件,即可.

  6. RabbitMq初探——php的一个demo

    <?php /** * Created by PhpStorm. * Date: 2017/10/17 * Time: 16:21 */ class Rabbit { public functi ...

  7. Spring定时任务执行

    备注:这个是基于搭建好spring的环境下的 注解方式: 1.定时任务类 package com.test;import java.util.Date;import org.springframewo ...

  8. 跑monkey前开启/关闭系统通知栏

    @echo off cls title 别忘了跑monkey啊 :menu cls color 0A echo. .禁用systemui并重启 echo. .启用systemui并重启 echo. e ...

  9. SpringMVC的JSP页面中中EL表达式不起作用的问题解决

    原文地址:https://blog.csdn.net/sinat_35512245/article/details/53611663

  10. Linux命令-关机命令:shutdown

    shutdown -h now 现在马上关机 shutdown -h : 晚上8:30定时关机shutdown -r now 现在马上重起shutdown -r 20:30 晚上8:30定时重起 ca ...