": > file" VS "> file"
bash, sh, shell, touch
Solution
`:` is the shell built-in NO-OP or null operation. So yeah, directing it to a file ends up with an empty file, as does directing nothing to a file. There's a sense, I suppose, in which your source is a different kind of nothing, but the result is the same. According to the advanced Bash scripting guide, the "`> file.out`" formulation won't work on some systems.
Note that in both cases (unlike "touch") the file contents will be replaced with nothing if the file already exists.
Problem
Is there any differences between ": > file" and "> file"? ``` $ : > file.out $ ls -l file.out -rw-rw---- 1 user user 0 Mar 18 21:08 file.out $ > file.out $ ls -l file.out -rw-rw---- 1 user user 0 Mar 18 21:08 file.out ```