[Bash] Put all function into one file
Create three bash file call A B C
A :
#!/bin/bash
print1()
{
echo $1
}
print2()
{
echo $1
echo $2
echo $3
}
B:
#!/bin/bash
PWD=$(pwd)
echo $PWD
source $PWD/A.sh
b=$1
print1 $b
C:
#!/bin/bash
PWD=$(pwd)
echo $PWD
source $PWD/A.sh
print2 $1
print2 $2
print2 $3
Excute B
The Result
bash B.sh 'ABCD' 'B' 'D'
/home/freeman/Desktop/test
ABCD
Excute C
The Result
bash C.sh 'ABCD' 'B' 'D'
/home/freeman/Desktop/test
ABCD
B
D
Reference :
0 意見:
張貼留言