![](/img/trans.png)
[英]How to run a shell script from another shell script reading first shell script name from a CSV file
[英]Reading commands from another file in a shell script?
看到我想在我的shell腳本中使用source
命令。 現在,當我在終端上鍵入source時,它顯示為
-bash: source: filename argument required
source: usage: source filename [arguments]
現在當我像這樣在我的shell腳本中使用它時
#!/bin/sh
source
並另存為test.sh
然后像這樣跑
./test.sh: 2: source: not found
如何解決這個問題呢?
您使用sh
而不是bash
運行腳本。 source
不在純sh
存在,但是您可以使用.
相反,它意味着同一件事。
#!/bin/sh
. /path/to/other/script
function_defined_in_other_script
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.