更新时间:2022-12-12 14:15:37
如果您不介意列表中的完整文件名,则可以使用.
If you don't mind the full filenames in the list then just this will work.
select JAR in *.jar; do
export NEW_PATCHID=$JAR
echo $NEW_PATCHID
REPLY=''
break
done
如果您确实介意(示例表明您可能)并且想要删除.jar
(我假设这就是cut
的含义,尽管cut -d. -f1
似乎比awk -F . '{print $1}'
更为简单)尽管时间更长),但以下内容可以安全地工作.
If you do mind (and the example indicates you might) and you want to drop .jar
(I'm assuming that's what that cut
is for though cut -d. -f1
would seem simpler for that as would awk -F . '{print $1}'
though that is longer) the following works safely.
jars=(*.jar)
select JAR in "${jars[@]%.jar}"; do
export NEW_PATCHID=$JAR
echo $NEW_PATCHID
REPLY=''
break
done