ps {1000..2000}
完美但是带有参数的bash脚本(像./1.sh 1000 2000
一样运行)
#!/bin/bash
ps {$1..$2}
无效
之前参数扩展。当$1
和$2
是括号内的文字字符串时,没有括号扩展,因此ps
的最后一个参数是文字字符串{1000..2000}
。
ps
的参数。for ((i=$1; i<=$2; i++)); do
args+=("$i")
done
ps "${args[@]}"
[如果有人告诉您使用eval
,请忽略它们。