linux - 运行命令循环,我想要输出名称
问题描述
我正在为命令运行一个循环,我希望输出名称是变量和字符连接的结果。
我有变量d
(即文件夹的名称)并想添加S
到 file1: 的输出名称的末尾,d=file1
并且我想要这样的输出名称:file1S
.
当我这样做-outdir "$d"s
时,输出的名称是 justs
并且运行第二个文件时出现错误消息
告诉我是否需要更多说明。
解决方案
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
推荐阅读
- python - 如何在 JES 中自动缩放
- javascript - 如何在 react material-ui-next 中创建导航栏
- reporting-services - 如果报告准备好在特定时间间隔内查看,我们如何使用机器人检查 SSRS
- r - 我可以使用 R 中的指针交换函数内的变量吗?
- rest - 通过 Azure REST API 获取 Azure VM 规模集专用 IP 地址
- jquery - jQuery; 代码在 HTML 页面中不起作用,但在控制台中起作用
- angular - 无法安装 angular-cli
- excel - 仅通过 VBA 代码发送带有附件的电子邮件
- javascript - 我想通过控制台执行 ng-click 功能,可以吗?
- android - 如何使用 Http POST 请求发送表情符号