#!/bin/sh
unset foo
(: ${foo%%bar}) 2> /dev/null
E1="$?"
I know foo is a variable, ${foo%%bar} means remove last bar in $foo.
But what does (: ) mean there ?  
I'm new to shell, can any one help me? Thanks!
#!/bin/sh
unset foo
(: ${foo%%bar}) 2> /dev/null
E1="$?"
I know foo is a variable, ${foo%%bar} means remove last bar in $foo.
But what does (: ) mean there ?  
I'm new to shell, can any one help me? Thanks!
 
    
    http://tldp.org/LDP/abs/html/special-chars.html
In combination with the >> redirection operator, has no effect on a pre-existing target file (: >> target_file). If the file did not previously exist, creates it.
 
    
    In bash, : means true.
Try :
: && echo ok; true && echo ok; : || echo ok; true || echo ok
