[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mtab very long



On Wed, May 25, 2005 at 11:28:04AM +0100, michael wrote:
> On Wed, 2005-05-25 at 12:00 +0200, Urs Thuermann wrote:
> >     : > /etc/mtab
> 
> what's the ':' do???

Nothing. At least hardly anything worth mentioning. See this snippet
from the bash manual:

#####
SHELL BUILTIN COMMANDS
       : [arguments]
    No effect; the command does nothing beyond expanding arguments and
    performing any specified redirections.  A zero exit code is returned.
#####

That also means it doesn't have any output. This empty output
is now redirected to /etc/mtab, making that file empty. You can try
other methods as well, e.g. 'cat /dev/null > /etc/mtab'.

maurits@mauritsvanrees:~$ echo "Hello World" > temp
maurits@mauritsvanrees:~$ cat temp
Hello World
maurits@mauritsvanrees:~$ : > temp
maurits@mauritsvanrees:~$ cat temp
maurits@mauritsvanrees:~$

Does anyone know any other uses for this ':' command?

HTH,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key: keyserver.net ID 0x1735C5C2
"Let your advance worrying become advance thinking and planning."
 - Winston Churchill

Attachment: signature.asc
Description: Digital signature


Reply to: