gpt4 book ai didi

linux - 使用 shell 命令的返回值作为 shell 脚本中的值?

转载 作者:IT王子 更新时间:2023-10-29 01:19:51 28 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Capturing multiple line output to a bash variable

例如,我想运行 ls 命令并将返回列表作为值保存在 shell 脚本中的数组中。

有点像

运行

#ls
fileA
fileB
fileC

将这个返回列表保存在一个保存数组的变量中

variable A = ["fileA","fileB","fileC"];

我无法给出准确的代码符号,因为我不知道如何编写 shell 脚本。学完这个,我就会。

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