TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:8923] SMB/scripting question
>#!/usr/bin/perl -w
>
>my $cmd = q[smbclient //process/c <password> -c 'ls /bin/running.txt'];
>
>my $output = `$cmd`;
>
>if ($output =~ /not found/i) {
> print "File not found.\n";
>} else {
> print "File exists.\n";
>}
yeah, I think that's about what I conceived. (just don't know perl
well enough to know the syntax).
I think I'll just go with the mount/check/unmount idea anyway.
(easier to understand for whoever comes after me).
is 'q(shell command);' the syntax for executing a shell command in perl?
alternatively, how do you check for the existence of a file or directory, in
a shell script?
I know how to check for the existence of a file in perl, but not how to
execute a shell command; and I know how to execute a shell command in a
shell script, but not how to check for the existence of a file...
the flexibility of the whole array of UNIX tools is a wonderful thing; but
no one ever said it made things easy to learn. :)
Carl Soderstrom
System Administrator 307 Brighton Ave.
Minnesota DHIA Buffalo, MN
carls@agritech.com (612) 682-1091