Sure - in your script, where you want to use the function, you can write a command like
source function.sh
which is equivalent to including the contents of function.sh
in the file at the point where the command is run. Note that function.sh
needs to be in one of the directories in $PATH
; if it's not, you need to specify an absolute path.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…