1
我有兩個bash
腳本:main one和auxiliary。插入一個bash腳本到另一個
比方說,主要腳本是:
#!/bin/bash
echo "This is start of my main script"
./auxiliary.sh
echo "This is end of my main script"
和輔助一個是:
cd some-folder
echo "This is file placed in some-folder by auxiliary script" > file1
cd ..
cd other-folder
echo "This is file placed in other-folder by auxiliary script" > file2
我的目標是要執行的輔助腳本行(或只是文本文件),就好像那些行已寫入直接在主腳本中。因此,例如,如果我從循環或函數內部調用auxiliary.sh
,則所有的auxiliary.sh行將在該循環或函數中執行。
你能舉個例子嗎? – cpburnz 2014-09-25 16:58:04