3 ms·
| cat > file vs. touch file With 'cat > file' you can actually type in the file's contents (then press ^d to finish). 'touch file' merely creates an empty file
by cristoperb 15y ago
| cat > file vs. touch file
With 'cat > file' you can actually type in the file's contents (then press ^d to finish). 'touch file' merely creates an empty file. (Not that I think 'cat > file' is much faster than 'vi file')
- badboy 15y agoOk, I should read more carefully. I thought the article uses cat > file followed by ^D to create empty files. Of course when having some text cat > file is just fine.
- icebraining 15y agoNo, you can remove 'cat' on most shells: > file
- LukeShu 15y agoWhat shell? I'm running bash 4.2.20(2)-release, and "> file" is behaving like "touch file".
- icebraining 15y agoYou're right, I was mistaken. It's just in Z shell.
- salvadors 15y agoYou mean there are other shells?