Skip to main content
10 events
when toggle format what by license comment
Dec 12, 2018 at 15:33 comment added Mirko Steiner Bash and sh seems to like > myfile but e.g. csh errors with: Invalid null command.
Dec 5, 2018 at 16:19 comment added CS Pei sometimes, > filename won't work. for example, in zsh. but : > filename works still.
Dec 3, 2018 at 11:12 comment added terdon Why would you do that? > file is enough to truncate a file. You don't need any command, just the redirection operator.
Dec 3, 2018 at 10:25 review Low quality posts
Dec 3, 2018 at 11:15
Dec 3, 2018 at 10:15 review Late answers
Dec 3, 2018 at 10:24
Dec 3, 2018 at 10:12 history edited Mirko Steiner CC BY-SA 4.0
added 38 characters in body
Dec 3, 2018 at 10:10 comment added Mirko Steiner Yes, and you redirect this with > in to the file, which creates the file if it does not exists, and if it exists you truncate it to zero. Better said: you use the : to do nothing, and use > to redirect nothing to a file, and truncate it.
Dec 3, 2018 at 10:06 comment added Haxiel man bash describes the : shell builtin as having no effect.
Dec 3, 2018 at 10:05 history edited Mirko Steiner CC BY-SA 4.0
added 2 characters in body
Dec 3, 2018 at 9:59 history answered Mirko Steiner CC BY-SA 4.0