Mailinglist Archive: opensuse (1786 mails)

< Previous Next >
Re: [opensuse] question on if clause formatting
On 11/10/2011 10:25 AM, George OLson wrote:
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?

What also is the "-f" option?

Thanks
George

http://www.linuxtutorialblog.com/post/tutorial-conditions-in-bash-scripting-if-statements

is one of the many places you'll be directed to if you use an
appropriate google search.
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
References