Mailinglist Archive: opensuse (1786 mails)

< Previous Next >
Re: [opensuse] question on if clause formatting
On 11/10/2011 10:41 AM, Anton Aylward wrote:
George OLson said the following on 11/09/2011 09:25 PM:
I am trying to set up ssh, and I find different command line examples on
the internet to help in my research. As I am learning CLI and scripting,
can someone explain the following to me please?

In a given directory, I typed in the following line.

if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600
authorized_keys ; fi

It created the file authorized_keys and gave it the time stamp and
changed the permission. I got that part.

The only thing I don't understand is the very first boolean clause after
the "if".

What exactly does the exclamation mark signify?

MAN(1) Test says

! EXPRESSION
EXPRESSION is false

Ah, ok, so the exclamation is just like saying "not"

Found the other info I needed also. Thanks for the help.

George


--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >