gpt4 book ai didi

linux - 在 Linux 的脚本环境中解密变量

转载 作者:太空宇宙 更新时间:2023-11-04 09:45:42 25 4
gpt4 key购买 nike

Unix shell 脚本中的$@ 表示什么。例如:

A__JOB="$CLASS $@"

$CLASS 是我的 java 类文件名。那么

可能是什么意思
$@.

我做了什么?我用 Google 搜索 :) 但 $@ 似乎是对 ir 的复杂查询,或者我可能不知道如何在谷歌中搜索特殊字符。

最佳答案

$@ 是传递的所有参数的值。

例如,如果您通过:

./script A B C D

那么 "$@"将等于 "A""B""C""D"

所以看起来目的是将传递给脚本的所有参数直接传递给java程序。

来自 bash 手册:

@ Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, "$@" is equivalent to "$1" "$2" ... If the double-quoted expansion occurs within a word, the expansion of the first parameter is joined with the beginning part of the original word, and the expansion of the last parameter is joined with the last part of the original word. When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed).

关于linux - 在 Linux 的脚本环境中解密变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16536396/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com