You are not logged in.
Pages: 1
Hi, i'm new in Arch, and i changed to them because i like stay always up to date. I'm really happy with Arch.
I have a little problem with the .bashrc, in this part of code:
if check_networksite "192.168.0.1"; then
estadolan="${yellow}>> LAN Connected"
else
estadolan="${yellow}>> LAN Disconnected"
fi
What can be the error there? I'm sure that the router's IP is that, but it says LAN Disconnected. Can anyone help me? Sorry for english and thanks ![]()
Offline
What is check_networksite supposed to do?
Offline
Does check_networksite exit with code "0" if it is connected. Remember: An exit code of 0 is success while anything different is interpreted as failure. This is contrary to programming languages where 0 often means false and 1 means true.
You should give us a little more output (check_networksite and what the rest of the script does) so we can help you better.
Offline
What is check_networksite supposed to do?
It checks if connected to router.
This code is part of my custom prompt.
__________ .__ __ .__ __
\______ \ __ __ | | ________ _/ |________|__| _____| | __ ____
| _/| | \| | \___ / \ __\_ __ \ |/ ___/ |/ // __ \
| | \| | /| |__ / / | | | | \/ |\___ \| <\ ___/
|____|_ /|____/ |____//_____ \ |__| |__| |__/____ >__|_ \___ >
\/ \/ \/ \/ \/
------------------------------------------------------------------------------
i686 >> 3.4.8-1-ARCH >> sáb ago 18 13:38:37 CEST 2012 >> LAN Disconnected
------------------------------------------------------------------------------
Logged in as rulz in machine archdesktop
[~]->
Anyway, thanks, using that javex said, and other helps, i made it work correctly ![]()
Offline
Wouldn't something like this:
sudo ping -c 1 192.168.1.1 >/dev/null && echo -e Connected || echo -e Disconnectedsuffice?
Edit: a bit too late...
Last edited by bohoomil (2012-08-18 12:25:54)
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
Hi bohoomil. I tried that, and it request me a password. I'm not good at bash, i'm learning
, so i couldn't fix the error. Anyway thanks, alternative codes always are interesting ![]()
Offline
The issue with password can be easily solved. You can either run
sudo visudoand put a line like this in the sudoers config file:
your_username ALL=(ALL) NOPASSWD: /usr/bin/pingOr you can set the SUID bit on the ping binary:
sudo chmod u+s /usr/bin/ping and run ping as a regular user (without sudo at all).
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
Pages: 1