首页 > 解决方案 > 运行命令循环,我想要输出名称

问题描述

我正在为命令运行一个循环,我希望输出名称是变量和字符连接的结果。

我有变量d(即文件夹的名称)并想添加S到 file1: 的输出名称的末尾,d=file1并且我想要这样的输出名称:file1S.

当我这样做-outdir "$d"s时,输出的名称是 justs并且运行第二个文件时出现错误消息

告诉我是否需要更多说明。

标签: linuxloopspatch

解决方案


Not sure if that's what you are looking for, but if you want to add an "s" to all of your files inside the directory, you can simply run the following loop:

for file in *; do mv $file ${file}s; done

推荐阅读