TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:8923] SMB/scripting question



Carl,

Those things can be found in:

	man sh
	man bash
	man csh

or whatever shell you are using.

I think [ -f /somepath/somefile ] will work for you, but read the man
page for sure.

Troy

Carl Wilhelm Soderstrom wrote:
> 
> >#!/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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org