Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I suppose there may be a one-line Linux command to check that.

share|improve this question
    
I'm curious why you'd want to check though –  Thomas W. Jun 6 '12 at 14:02
add comment

1 Answer

up vote 4 down vote accepted

I don't know if you can specifically identify what you're looking for, and I'm not entirely sure what you mean since Google Apps is a suite of stuff. Sites are hosted by other products that form a part of Google Apps. I'm assuming that you mean to refer to Google Sites.

The function below actually looks for sites that contain GSE in their server name in the HTTP headers. Cursory tests indicate that this will identify Google Sites, but those tests are incomplete.

Define this function somewhere. You can type it directly into Bash, or put it into one of your shell startup files:

function hosted_by_google_sites {
  if [[ "$(curl --head --silent "$1" | egrep '^Server:')" =~ GSE ]]; then
    return 0
  else
    return 1
  fi
}

You can use it like this:

if hosted_by_google_sites "http://www.example.com/some_url"; then
  do_something
fi

Or:

hosted_by_google_sites "http://www.example.com/some_url" && echo "Yes. Hosted by Google sites."

You said you wanted a one-liner. I'll leave that as an exercise for you, since representing this as a function is far superior, IMO. It could be done as a one-liner, but it'd be messy.

share|improve this answer
    
That's right, it was Google Sites. That's exactly it, no need for one-liner. Thank you. –  Strapakowsky Jun 12 '12 at 3:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.