在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/study# vi test2;
#! /bin/bash
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#