如何提取部分输入文件名来命名输出文件
How to extract partial input filename to name output file
我有一个 bash 脚本 (script.sh) 作用于名为 12345.txt 的文件,该文件当前生成名为“12345.txt_output”的输出文件:
命令行:
bash script.sh 12345.txt
script.sh 的最后一行:
> "_output"
如何更改输出命令(同时仍使用 $1)将文件命名为 12345_output(而不是 12345.txt_output)?
bash 字符串函数
> "${1%.*}_output"
我有一个 bash 脚本 (script.sh) 作用于名为 12345.txt 的文件,该文件当前生成名为“12345.txt_output”的输出文件:
命令行:
bash script.sh 12345.txt
script.sh 的最后一行:
> "_output"
如何更改输出命令(同时仍使用 $1)将文件命名为 12345_output(而不是 12345.txt_output)?
bash 字符串函数
> "${1%.*}_output"