Autofs provides a facility to allow metacharacters to be included within the maps—in the same way that the shell allows them within its syntax. Table 18.10 shows the ones that are available, along with an example of how they may be used.
Metacharacter | Function | Example |
---|---|---|
& | Substitute the key | msmith neon:/export/home/& |
* | Matches any key | * neon:/export/home/& |
" | Escapes special characters | msmith neon:/”some location” |
For example, we can see that most lines in the auto_home map are the same, apart from the user name. Using metacharacters, we could shorten the auto_home file to the following:
testuser neon:/export/home/& sysadmin neon:/export/home/& msmith neon:/export/home/& jgreen neon:/export/home/&
Or to match every home directory, we could use the following:
* neon:/export/home/&