Shell “使用什么语言?”;“金融机构”;
看到这个脚本,我正试图找出使用什么语言。。。它几乎像C,但我注意到fi是关闭嵌套if的一种方式Shell “使用什么语言?”;“金融机构”;,shell,Shell,看到这个脚本,我正试图找出使用什么语言。。。它几乎像C,但我注意到fi是关闭嵌套if的一种方式 function prompt () { if [ "$noprompt" ] && [ "$#" = "1" ]; then if [ "$1" = "yes" ]; then echo "DEFAULT: yes" return 0 else echo "DEFAULT: no" return 1
function prompt () {
if [ "$noprompt" ] && [ "$#" = "1" ]; then
if [ "$1" = "yes" ]; then
echo "DEFAULT: yes"
return 0
else
echo "DEFAULT: no"
return 1
fi
fi
while true; do
echo "Enter \"yes\" or \"no\": "
read response
case $response
in
Y*) return 0 ;;
y*) return 0 ;;
N*) return 1 ;;
n*) return 1 ;;
*)
esac
done
}
看起来像一个shell脚本—可能是bash。这是一个用shell编写的脚本。看起来像一个(bash)Unix shell脚本使用的脚本。。。
请参阅和。这段代码是Unix shell。但问题的答案是什么 什么语言使用“fi”
有点长。镜像词的用法,如
if
和fi
或case
和esac
来自Algol,有关详细摘要,请参阅。是谁把这个从Algol带到unixshell的,他首先研究Algol,然后研究早期Unix系统的sh
和adb
。他非常喜欢这种语法,甚至他为sh
和adb
编写的C
代码由于一堆预处理器宏看起来都像Algol。好奇的人可以看看or的2.11BSD源代码。毕竟它是以C语言编译的。因此,即使在C语言中,我们也可以在历史上找到FI
。FI
被Unix/Linux shell用于shell编程,这是一个
if
语句
if [ expression ]
then
Statement(s) to be executed if expression is true
fi
它主要由
sh
命令Shell脚本运行。可能是sh、bash或类似的