Operating Systems > Linux and UNIX
shell script question
(1/1)
Stryker:
In bash of course...
I would like to be able to do something like:
--- Code: ---
--- End code ---
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:
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?
Stryker:
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?
--- End quote ---
Because I wanna do it this way ;)
Good thing to know anyways
solo:
--- Code: ---
--- End code ---
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.
Navigation
[0] Message Index
Go to full version