在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#