file" in the script, I dint understand the meaning, can any tell me what's the command..." /> file" in the script, I dint understand the meaning, can any tell me what's the command..." /> file" in the script, I dint understand the meaning, can any tell me what's the command..."/>

shell scripts symbol ": >"

258 views Asked by At

I m a newbie at shell scripting, recently I saw a command ": > file" in the script, I dint understand the meaning, can any tell me what's the command doing?

Thanks, in advance

2

There are 2 answers

0
cadrian On

It creates and/or empties the file. The : command is a bash built-in that just does nothing.

0
Simon Richter On

: is a no-op. > is a redirection, so the file is overwritten with the output from the no-op command (i.e. the file exists and is empty afterwards).