相关疑难解决方法(0)

如何在序列的 shell 括号扩展中使用 $variable?

我想$var in在 bash 中使用带有范围的 shell 括号扩展。简单地放置{$var1..$var2}不起作用,所以我去了“横向”......

以下工作,但它有点笨拙。

# remove the split files
echo rm foo.{$ext0..$extN} rm-segments > rm-segments
source rm-segments
Run Code Online (Sandbox Code Playgroud)

有没有更“正常”的方式?

shell bash brace-expansion

46
推荐指数
2
解决办法
2万
查看次数

Bash:如何替换上一个命令中的字符串?

我需要在行或 URL 中替换一个单词,但我需要从命令行/终端进行。

我的意思是

$ ./myscript.sh xxx.xxx.xxx.xxx:8080/code -c code1 -t query
Run Code Online (Sandbox Code Playgroud)

现在从那里开始,无需返回,我需要替换code1mycode或其他一些字符串。

command-line bash

20
推荐指数
2
解决办法
1万
查看次数

标签 统计

bash ×2

brace-expansion ×1

command-line ×1

shell ×1