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

Re: bootmisc.sh



Hi!

On Wed, Jan 04, 2012 at 06:10:11AM -0500, Balint Szigeti wrote:
> hello
> 
> I found this
> 
>                             : > /var/run/utmp
> 
> in /etc/init.d/bootmisc.sh on Debian 6.0.3
> 
> Can you explain what does " : > " mean?

The ":" is an empty command - which has it's output redirected, thus
truncating the file.

It is documented (deep down) in e.g. the bash(1) man page under
BUILTIN COMMANDS (the sh-compatible shells usually have this):

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

This is *nearly* the same as :

     echo > /var/run/utmp

except that the "echo" would emit a newline character - usually OK for
text files, but not for binary files like utmp...

Hope this helps

-- 
Karl E. Jorgensen


Reply to: