The > operator specifically calls the openat() system call with O_WRONLY|O_CREAT|O_TRUNC flags. Note also that a filename - is treated specially, so if you do want to create a file that is named literally -, you'll have to enclose that into single or double quotes.īy contrast, > is a shell redirection operator for stdout stream. Its original purpose is to update the access and modification time of a file, however if the file does not exist - it will be created. Most commonly new filename is created with something like this: That means if you call any command-line utility that does these system calls, you can create a new empty file. In general, creating any regular 1 file on Linux involves open(2), openat(2), and creat(2) system calls (and specifically with O_CREAT flags).
0 Comments
Leave a Reply. |