3 ms·
> $ touch myfile.txt If we're playing golf, this works (overwriting if the file exists): >myfile.txt
by seanwilson 5y ago
> $ touch myfile.txt
If we're playing golf, this works (overwriting if the file exists):
>myfile.txt
- jeramey 5y agoDepends a bit on your shell. That works great in bash. Other shells have different semantics. For example, zsh will wait for input until you type ^D or ^C and tcsh will complain about an invalid null command. The variant I know that works identically in pretty much every shell I've ever tried is: :>myfile.txt And if you don't want to overwrite the file if it exists: :>>myfile.txt