As part of a batch script, I have the following command:

```
hostname=$(nmblookup -A $ip_address | awk '$2 == "<20>" {print $1}')

```

Which works fine from a functinality perspective, even for unresolved hosts.

The problem is that when the IP address is not reachable or the remote machine does not respond to the SMB request, the command takes about ten seconds to complete. Therefore, the question is simple: is there a way to lower the elapsed time in such cases? Or, in other words, is there a way to set a custom timeout for the `nmblookup` command?

**NOTE:** I'm interested in solutions that do **not** make use of `SIGALRM` or similar mechanisms; if they exist. The `nmblookup` version is `3.6.3` from Ubuntu 12.04 LTS.