#!/usr/bin/perl -w use strict; use diagnostics; sub usage { print "usage: $0 'host:NFS exported directory'\n" } usage(), exit(1) if not @ARGV; foreach (@ARGV) { my ($host, $dir) = m!^([.\w]+):(/[\S]+)$! or (warn "$_ not in form host:dir, skipping", next); my $localdir = "/mnt/nfs/$host/$dir"; unless (-d $localdir) { system("mkdir -p $localdir") && (warn "cannot make $localdir, skipping $_", next); } system("mount -v -t nfs $_ $localdir") && warn "could not mount $_ as $localdir"; }