[Samba] Re: How can $VARIABLES be used inside smbclient -c'xyz' command strings?

Kurt Pfeifle kpfeifle at danka.de
Tue May 21 04:43:02 GMT 2002


Thanks, Joel,

for your answer. It is not ftp, it is smbclient (which will be on HP-UX)
and the receiving end is a WinNT4 box.

Joel Hammer wrote:
> Will the ftp box act as an ftp server?
> If so, an expect script might be a good way to transfer them.
> 

Hmmm, "expect" is even more "new" to me than the shell scripting stuff...
I'll start reading the manpage tonight, and google for documentation,
tutorials and examples of expect scripts..

> This command worked fine for me:
> smbclient //HAMMER2/ELLEN -N -c "put junkheader.txt"  

This works for me too, even in the form of using single quotes (')
instead of double ("). But here you *named* the file.

*I* need to call it by its reference as a commandline parameter.

> where junkheader.txt is a file on the local system. $1 should work. The
> original file name is preserved.

Maybe "preserved". But it is a kind of double nesting: $1 is recognized
inside the shell script; but then inside the script there is smbclient
called, and the "-c" (for commands to be executed by smbclient) needs
quotes and inside these quotes the $1 isn't recognized any more.

I don't need to rely on smbclient, I just need a method to process a
file "file-orig" through a script (called as "script.sh file.orig"),
which generates a second file, "file-orig.extension", and then transfer
both to the NT box, preserving their names "file-orig" and
"file-orig.extension".

[I succeeded to transfer by renaming the files "file.orig" to allways
the same name "new-static-name" and transfer the "new-static-name" to
the NT-box.... but that is not the purpose...]

Thanks again,
Kurt


> Joel
> 
> On Tue, May 21, 2002 at 04:36:39AM +0200, Kurt Pfeifle wrote:
> 
>>Kurt Pfeifle wrote:
>>
>>>Hi,
>>>
>>>being a total newbie in shellscripting and similar stuff, I
>>>am suffering from a brain freeze around the following problem:
>>>
>>>* I need to print (or transfer otherwise) to a WinNT box;
>>>* the files are send from inside a shellscript;
>>>* the script gets the filename on the commandline when started;
>>>* so the only knows it works on "$1";
>>>* the problem is, that the original filename needs to be conserved
>>>  when it arrives on the WinShare...
>>>
>>>Anyone with a suggestion?
>>>
>>
>>What I tried is this:
>>--------------------
>>
>>export FILENAME=testfile.ps
>>
>>kde-bitshop:/home/kde4 > smbclient //transmeta/ljet5 -N  -c 'put $FILENAME'
>>added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
>>Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.4]
>>$$FILENAME does not exist
>>
>>kde-bitshop:/home/kde4 > echo $FILENAME
>>testfile.ps
>>
>>kde-bitshop:/home/kde4 > smbclient //transmeta/ljet5 -N  -c "put $FILENAME"
>>added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
>>Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.4]
>>$FILENAME does not exist
>>
>>
>>-- 
>>To unsubscribe from this list go to the following URL and read the
>>instructions:  http://lists.samba.org/mailman/listinfo/samba
>>
> 







More information about the samba mailing list