bash - 如何将文件名与变量一起导出?
问题描述
我的代码是:
a = 5335672
cat 1.txt 2.txt 3.txt > file_master_echo $a .txt
最后,我希望输出文件名是:
file_master_5335672.txt
解决方案
没有必要在echo
那里使用(也必须指出它不是正确的使用方式)。此外,定义变量时不能留空格。也就是说,只需尝试:
a=5335672
cat 1.txt 2.txt 3.txt > file_master_$a.txt
推荐阅读
- javascript - 如何在 create-react-app 中使用 scss 文件?
- python - python3 502 网关错误
- python - Tensorflow 损失和准确性在不同时期之间不会发生变化
- caching - Haproxy 1.8 和缓存
- shopify - shopify集合页面上的分页
- python - 为什么我不能在 OSX 的 pipenv 中安装 m2crypto?
- python - 如何使用 Python 代码在 Travis Ci 上运行 sonarcloud
- mysql - 从两列中选择较少的日期时间
- linux - 从 tcpdump 输出中删除不必要的字符
- python - 使用 PySpark 从 Amazon S3 读取文本文件