Is /etc/rc.conf scriptable?

Yue Wu vanopen at
Tue Feb 1 12:35:19 UTC 2011

Hi list,

I'm trying to do something to make rc.conf can act conditionally

What I want is:

1. List the wireless access points,

grep if there is one which bssid is 'bb:bb:bb:bb:bb:bb',

if there is, then set ifconfig_wlan0 to the value:

    "inet netmask WPA"

2. check if bitlbee has been installed, if so, then let bitlbee
service start.

So I tried with following settings in rc.conf, but all of them failed,
i.e., the networking can't be connected and bitlbee service doesn't


if ifconfig wlan0 list scan 2>/dev/null | grep -q 'bb:bb:bb:bb:bb:bb' >/dev/null 2>&1; then
    ifconfig_wlan0="inet netmask WPA"
if [ -x /usr/local/sbin/bitlbee ]; then

My question is, how to achieve what I want? The simpler, the better :)

Yue Wu

Key Laboratory of Modern Chinese Medicines
Department of Traditional Chinese Medicine
China Pharmaceutical University
No.24, Tongjia Xiang Street, Nanjing 210009, China

More information about the freebsd-stable mailing list