LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2006, 02:06 PM   #1
dohpaz
Member
 
Registered: Feb 2006
Location: Edmonton
Distribution: Slackware 12.2, Ubuntu
Posts: 117

Rep: Reputation: 16
shell script to mount samba share with " " in the remote path


I am trying to write a script that will allow me to avoid having to type:
mount -t smbfs -o username=foo,password=bar //myserver/share /mnt/smb
every time I want to mount a samba share.

What i have is:

mount -t smbfs -o username=foo,password=bar //192.168.0.$1 /mnt/smb

This works with a remote share like:

myscript.sh 101/MySharedRemoteFolder

But not with:
myscript.sh 101/My Shared Folder

How can I modify the script(or the way I'm using it) to allow remote paths with " " (spaces)?

I tried both:

myscript.sh "101/My Shared Folder"
myscript.sh '101/My Shared Folder'
 
Old 10-20-2006, 02:11 PM   #2
dohpaz
Member
 
Registered: Feb 2006
Location: Edmonton
Distribution: Slackware 12.2, Ubuntu
Posts: 117

Original Poster
Rep: Reputation: 16
Also I tried:

myscript.sh 101/My\ Shared\ Folder
and
myscript.sh "101/My\ Shared\ Folder"
 
Old 10-20-2006, 02:18 PM   #3
dohpaz
Member
 
Registered: Feb 2006
Location: Edmonton
Distribution: Slackware 12.2, Ubuntu
Posts: 117

Original Poster
Rep: Reputation: 16
what I had to do was modify my script from:

mount -t smbfs -o username=foo,password=bar //192.168.0.$1 /mnt/smb

to:

mount -t smbfs -o username=foo,password=bar "//192.168.0.$1" /mnt/smb
 
  


Reply


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
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
Samba configuration error when accessing NTFS files " Network path not found" leo_ieo Linux - General 2 10-09-2006 08:55 PM
Samba problem with "add share command" bit128_linux Linux - Software 0 05-23-2006 05:26 AM
Authenticating to Samba share using "Active Directory Server" hlslaughter Linux - Software 36 07-23-2004 10:59 AM
Samba & Win2K pro, "network path not found" RedHat123 Linux - Networking 8 02-05-2002 09:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:48 PM.

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
Open Source Consulting | Domain Registration