Bash shell 如何将日期格式化为小写月份?

标签 bash shell scripting

以下命令生成日期 Sept18_1024x728.jpg 我该如何制作它,以便它会使用 sept18_1024x728.jpg 对其进行格式化?

           cp "$p" "./FOLDER/$(date +%b%d).$SIZE.jpg"

最佳答案

您可以通过tr管道将大写转换为小写:

cp "$p" "./FOLDER/$(date +%b%d | tr A-Z a-z).$SIZE.jpg"

或者区域设置感知版本:

cp "$p" "./FOLDER/$(date +%b%d | tr '[:upper:]' '[:lower:]').$SIZE.jpg"

关于Bash shell 如何将日期格式化为小写月份?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52394361/

相关文章:

bash - 当使用空参数运行 grep 时,为什么 "while read"循环会停止?

bash : Execute command before redirection as standard input

linux - 如何检查bash脚本中$1是否包含特殊字符?

bash - 在 bash 中引用命名参数的正确方法是什么?

windows-mobile - Windows Mobile - 有哪些脚本平台可用?

batch-file - 如何通过批处理文件启动 UWP 应用程序?

c# - 如何在 VS 2015 中启用 C# 脚本?

c - 如何从 bash 向 C 程序提供输入?

linux - 当使用 ssh 作为 oracle 用户连接时以 root 身份运行脚本

linux - 在 info bash 中找不到 'date' 命令的描述 - 找到可从 shell 调用的所有命令的列表