Bash 简单功能
示例
在helloWorld.sh
#!/bin/bash
# Define a function greet
greet ()
{
echo "你好,世界!"
}
# Call the function greet
greet在运行脚本时,我们看到了消息
$ bash helloWorld.sh 你好,世界!
请注意,使用功能采购文件会使它们在当前bash会话中可用。
$ sourcehelloWorld.sh # or, more portably, ". helloWorld.sh" $ greet 你好,世界!
您可以export在某些外壳程序中使用某个函数,以便将其公开给子进程。
bash -c 'greet' # fails export -f greet # export function; note -f bash -c 'greet' # success
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短