Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 17 of 17
This is becoming OT, but no. Not best practice. You would then need to call that script explicitly with bash <script> Which a) is not necessary (because there are shebangs) ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,445

    This is becoming OT, but no. Not best practice.

    You would then need to call that script explicitly with bash <script>
    Which
    a) is not necessary (because there are shebangs)
    b) adds complexity. Before calling a script, you would need to look into it to check if its perl/bash/python/zsh/ksh/etc
    You must always face the curtain with a bow.

  2. #12
    Just Joined!
    Join Date
    Nov 2011
    Location
    New Zealand
    Posts
    79
    Quote Originally Posted by Irithori View Post
    This is becoming OT, but no. Not best practice.

    You would then need to call that script explicitly with bash <script>
    Yeah it's going OT but just to clarify, a bash script should be able to run without the #! line when executed within a bash shell - which is usually the norm. But as we both agree it is not best practice or very transportable.

  3. #13
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,445
    ..which might not always be the case, if the script is called via cron, exec´ed from a php site, or if a user just prefers a tcsh instead of bash, or..

    But ok, let´s leave it
    You must always face the curtain with a bow.

  4. $spacer_open
    $spacer_close
  5. #14
    Just Joined!
    Join Date
    Nov 2011
    Location
    New Zealand
    Posts
    79
    Sure

    Here endeth todays lesson about #!

    #! is a good distro too

  6. #15
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    Back on subject:

    A successful query
    Code:
    wget google.com && echo "WE GOT IT" || echo "Failure"
    An unsuccessful query
    Code:
    wget asddfadghaga.com && echo "WE GOT IT" || echo "Failure"
    From what I gathered, you simply are seeking if the website responds and with what is unimportant. This is as simple as it gets.
    linux user # 503963

  7. #16
    Just Joined!
    Join Date
    Dec 2011
    Posts
    4
    Can i search for a word?

    If my index has de word server1 or server2 than i will show server1 / server2 or if my site not work : error

    Does anyone know how i muss do this?

    thx

  8. #17
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    I think wget understands regular expressions.

    Why not just pipe it through sed?
    linux user # 503963

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •