LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-25-2015, 03:02 AM   #1
Dustin Cook
Member
 
Registered: Feb 2015
Posts: 31

Rep: Reputation: Disabled
Sending SMB Client Commands Through Shell Script


Hello.

I have a shell script, which I am using to access the SMB Client:

Code:
#!/bin/bash
cd /home/username
smbclient //link/to/server$ password -W domain -U username
recurse
prompt
mput baclupfiles
exit
Right now, the script runs, accesses the server, and then asks for a manual input of the commands.

Can someone show me how to get the commands:
Code:
recurse, prompt, mput baclupfiles and exit
to be run by the shell script please?
 
Old 02-25-2015, 05:01 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Do you want those commands run by smbclient? If so a "here document" should do it.

Code:
#!/bin/bash
cd /home/username
smbclient //link/to/server$ password -W domain -U username << ENDOFMYSMBCOMMANDS
recurse
prompt
mput baclupfiles
exit
ENDOFMYSMBCOMMANDS
 
1 members found this post helpful.
Old 02-25-2015, 05:18 AM   #3
Dustin Cook
Member
 
Registered: Feb 2015
Posts: 31

Original Poster
Rep: Reputation: Disabled
Thanks linosaurusroot! That solved my problem!

It's a nice neat solution too - I like it
 
  


Reply

Tags
shell, smb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
best way to automate shell commands - shell script or python scripts or something els parangsaraf Linux - Newbie 11 08-08-2012 07:17 PM
Issue in running commands in expect script from shell script yadvinder Programming 0 05-31-2012 05:07 AM
Sending mail from shell script sinoob Linux - Server 3 07-07-2011 08:43 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 03:34 PM
Shell script sending mail mfrick Linux - General 5 09-01-2005 08:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration