Author Topic: shell script question  (Read 549 times)

Stryker

  • VIP
  • Member
  • ***
  • Posts: 1,258
  • Kudos: 41
shell script question
« on: 22 June 2003, 10:47 »
In bash of course...

I would like to be able to do something like:

Code: [Select]

Can anyone help with making the above work properly?

In case you can't tell, I want to make a script that will tell me when I get online. As with ifup it doesn't say the dialing status.

Thanks

Faust

  • Member
  • **
  • Posts: 1,223
  • Kudos: 0
shell script question
« Reply #1 on: 22 June 2003, 11:51 »
WHy not just make a script to ping some "always up" site (google) every so often and then report connnection statuse based on the last ping?
Yesterday it worked
Today it is not working
Windows is like that
 -- http://www.gnu.org/fun/jokes/error-haiku.html

Stryker

  • VIP
  • Member
  • ***
  • Posts: 1,258
  • Kudos: 41
shell script question
« Reply #2 on: 22 June 2003, 11:53 »
quote:
Originally posted by Faust:
WHy not just make a script to ping some "always up" site (google) every so often and then report connnection statuse based on the last ping?


Because I wanna do it this way   ;)  

Good thing to know anyways

solo

  • Member
  • **
  • Posts: 344
  • Kudos: 1
    • http://www.komodolinux.org/
shell script question
« Reply #3 on: 23 June 2003, 07:24 »
Code: [Select]

The bash if statement doesn't do conditional at all, the test builtin does. Bash creates an alias called '[' so you can do 'if [ "$x" = 2 ]; then' and make it look nice. The if statement actually just performs another statement, and if the statement returns 0 then it does the stuff between 'then' and 'fi'. And of course all executables and bash commands return status integers.

So you were close.
Komodoware, moving Linux to your desktop.
http://www.komodoware.com/