Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While digging through the birds-nest of network initialisation in our embedded linux setup (Linux SDK on Leopardboard SBC) we've come across what seems like an odd and possibly non-functioning line in /etc/network/interfaces:

# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
        pre-up /bin/grep -v -e "ip=[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" /proc/cmdline > /dev/null

Now, the kernel cmdline in this system may contain the line "ip=" or some other address, but this line specifically ignores it if it matches (grep -v = show non-matching lines only). Also, it's redirecting it to /dev/null, so it would seem futile either way.

Has anyone seen something like this or got any ideas what it could be doing / might be intended to do, other than nothing?

share|improve this question
up vote 4 down vote accepted

From man interfaces:

       pre-up command
          Run command before bringing the interface up.  If  this  command
          fails then ifup aborts, refraining from marking the interface as
          configured, prints an error message, and exits  with  status  0.
          This behavior may change in the future.

From there, I would guess that the command you quoted is basically a test, destined to abort the ifup and reconfiguring the interface, if there's already and ip=... line in cmdline. The redirection to /dev/null is applied to the pre-up error message, not the grep.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .