On Mon, Nov 19, 2001 at 10:39:39PM +0530, Tathagata Banerjee wrote:
> here is lost no. 200:
> 
> ********************************************************************
> Sub: Creating an empty file                         LOST #200
> 
> To quickly create an empty file, use "touch filename"
> or echo "" > filename
> 
> ********************************************************************
> 
> but an even simpler way is just to do a
> 
> $   >filename
> 
> no command is needed. just a hanging redirection sign will do it   :-)
> 
> this works in bash. i'm not sure about other shells.
> 
> - tathagata.
> 
---end quoted text---

I had included this LOST from the freebsd fortune. I suppose
it is better to explain this a bit. There  are  three things
which does almost similar functions:

touch filename ... essentially this  updates the  date/ time
                   stamp, and if file  does not exist ... it
                   makes a new one. It does NOT overwrite an
                   existing file with the same name.

> filename     ... This is supported by BSD shells like bash
                   ash ... AFAIK, not supported  by  ksh and
                   family.
                   
cat "" > fname ... Works on all shells, but  over-writes any
                   exiting file.
                   
The same is also possible with "cat /dev/null > filename" ..

But NEVER make the mistake of doing a cat /dev/zero > fname!
This will fill your whole hard disk with a file  which would
be difficult to delete !!!

Thanks for pointing this out anyway. I think I'll modify the
current LOST #200, I'll make a new LOST with hanging redire-
ction in your name ...

Bish
                 
--
:
####[ Linux One Stanza Tip (LOST) ]###########################
  
Sub : Deleting dot files                             LOST #163

Doing a 'rm -f *' within a directory will remove all the files 
within the directory but NOT invisible DOT (.) files. You need 
to do a:  '$rm  .[A-Za-z0-9]*'           # To delete DOT files

####<[EMAIL PROTECTED]>####################################
:


_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to