[英]Declare Variables from a shell script in the shell
Can you guys tell me how to write a shell script which declares for example a variable in the shell like this: var="foobar". 你们能告诉我如何编写一个shell脚本,例如在shell中声明一个变量:var =“foobar”。 It just has to write the exact same thing like I would write it manually in the shell.
它只需编写完全相同的东西,就像我在shell中手动编写它一样。
appreciate help because this would help me a lot ! 感谢帮助,因为这对我很有帮助! I am not so experienced in shell scripting :/
我在shell脚本方面不是很有经验:/
For this, you have to create a script ( file.sh
, for example) containing the line: 为此,您必须创建一个包含以下行的脚本(例如
file.sh
):
var="foobar"
and then source the file: 然后获取文件:
source file.sh
or 要么
. file.sh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.