if $(/sbin/ifconfig eth0 2&>1 >/dev/null); then echo eth0 exists; else echo eth0 does not exist; fi
The above script line will print a message based upon whether or not eth0 exists. To actually test whether it is connected, you will need a command other than
ifconfig (perhaps pinging your router?). Modify the
echo statements to call the appropriate scripts.
The "2&>1 >/dev/null" in the command effectively instructs it to run without producing any output. The "2&>1" redirects error messages to the program's standard output and the ">/dev/null" redirects that to the bit bucket (i.e., "nowhere"). The only thing of interest from the ifconfig command is its return value, which is tested by the "if" statement (a return of non-zero means the command failed).
I would not recommend placing your script in "/usr/sbin" because there is no guarantee that /usr will be mounted at the time your script is executed. It is not unreasonable for the bootup sequence to wish to access the network before mounting "extra" partitions (the only partition guaranteed to be mounted at boot time is the root partition, "/"). Your script should be placed in either "/sbin" or in "/etc/rc.d/" (my preference would be the latter, with a script named "rc.linksys-WPA" or somesuch).