MySQL Workbench

Jordon Bedwell jordon at envygeeks.com
Thu Nov 11 06:17:39 UTC 2010


On 11/10/2010 11:41 PM, Kaushal Shriyan wrote:
> Hi Jordon,
> 
> what does -- signify after grep command in apt-cache search mysql
> |grep -- ^mysql-

It tells Debian to stop processing binary options.  In this instance it
was not necessarily needed because you only have a single dash, but I
always use it when I have a dash or double dash just to be safe in
practice and to guarantee what I meant is what I meant.  It's a simple
habit to keep me reminded.

Some things do require -- before you can process - or -- for example
just type 'grep --' and get an error, type 'grep -- --' and it will
search for '--'.

You also use it to tell Debian to stop processing binary options when
you are passing to another binary. [Here is why I have the habit to
remind myself even with a single dash] example:

start-stop-daemon -S -p $PIDFILE -x /usr/bin/binary -- -o -p -t

If you would not have used the double dash to tell Debian to stop
processing options then Debian and the start-stop-daemon binary would
have assumed that everything after /usr/bin/binary was meant for
start-stop-daemon and not for /usr/bin/binary as one its options.

Here is an interesting way to test it out:

1.) cd /home/username
2.) echo 'Delete me?' > --
3.) rm -r --

You get an error:
rm: missing operand
Try `rm --help' for more information.

4.) rm -r -- --

Now you've learned what it's used for.




More information about the ubuntu-users mailing list