File name trick
20 Apr 2010
I was coding a little script that save files names into a file.
To avoid any bug in this script I wondered if there were a way to have a file with \n (carriage return) in their name....
And after some tests...
I found a way to create files with \n in their name...
In fact it's pretty simple :
echo -n -e "test\nsecond line" | xargs -0 touch
Then you obtain a file that name has two line.
It's funny to see how other application behaves with theses files or folder (replace touch by mkdir).
For example gedit tab are shown on several line, nautilus expand its header etc etc.
I think that it could introduce bugs in some applications (from UI layout bugs to crash of an application).
But let me show you something a little bit more fun with this :
for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z; do figlet $i | sed "s#/#%#g" | xargs 0 touch; done
It will create a file by alphabet letter with a ASCII art name!!
You can also try with any ascii art generator (from jpeg files). Just be aware of the fact ascii art should not contain "/" char (else it will be consider as path separator) (that the reason why I added a sed in last command).
If you find some funny command on the same idea, let me know it :).
(I'm also interested if you find a way to use custom (mono) font in nautilus for file name display ! )