在外壳中创建日期格式为dd/mm/yyyy的文件名 [英] Create file name with date format dd/mm/yyyy in shell
问题描述
最近,我遇到了使用bash shell创建具有日期格式的文件名的情况,如下例所示
Recently, I come across creating a file name with date format as below example by using bash shell
touch 22/04/2017
它会引发错误,这意味着您无法使用这种格式创建文件名.
It throws error, which means you can't create file name with this format.
touch: 22/04/2014: No such file or directory
有人知道吗?
推荐答案
警告:这只是为了做到这一点而做的一种方法,实际上并不推荐也不使用.首先是不允许使用此类字符的原因.
Warning: This is a way to do it just for the sake of doing it, it's not actually recommended nor used. There are reasons such characters are not allowed in the first place.
如果您需要这样做,可以使用此一个看起来与/
完全相同但不是的字符.
通常,正如Guillaume Jacquenot所说,不允许使用此类文件名.
If you need to do that, you could use this character which looks exactly like the /
but is not.
Generally, as Guillaume Jacquenot said, such filenames are not allowed.
这篇关于在外壳中创建日期格式为dd/mm/yyyy的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!