LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 11-09-2004, 09:07 AM   #1
JohnKFT
Member
 
Registered: Aug 2003
Location: NW Scotland
Distribution: Slackware 10
Posts: 169

Rep: Reputation: 30
Spaces in file names


I use wmf2gd --auto to instantly convert windows metafiles to png files for inclusion in various graphics programs. This works fine until it meets a filename containing spaces whereupon it stops at the first space and says it cannot find the expected suffix .wmf. I have scoured the forums for a simple answer but they all involve complex programming or knowing the filename to begin with.

I have a ROX wrapper containing #! /bin/sh then wmf2gd --auto $1 and simply dnd the file off the CD onto it. With no filename spaces it makes me a png file with the same name in the folder holding the wrapper. I can then pick it up and drop it where I want it. Can anyone tell me how to make it cope with spaces in filenames? ROX itself copes OK as do other programs so I think it is just the terminal.

Edit as one paragraph was too long!

Last edited by JohnKFT; 11-09-2004 at 09:08 AM.
 
Old 11-09-2004, 09:20 AM   #2
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
The Unix - Linux way of dealing with spaces in command line is this. For example:

This is a file.exe (Windows)
This\ is\ a\ file.exe (Linux)

See how the \ makes Linux know that the next character is not a space. I believe this char (\) is used to create multiline commands.

You should use this somehow in your script.
 
Old 11-09-2004, 11:16 AM   #3
OrphanedLand
LQ Newbie
 
Registered: Dec 2003
Distribution: Slackware
Posts: 26

Rep: Reputation: 15
\ means following character is not special character, it is a printable character. If you write \ and then press enter, it wont process the line, it will go to new line.

Also \\\\\\\\\ = \

All this features come from C language because of bash had been written using C language
 
Old 11-09-2004, 04:44 PM   #4
JohnKFT
Member
 
Registered: Aug 2003
Location: NW Scotland
Distribution: Slackware 10
Posts: 169

Original Poster
Rep: Reputation: 30
Thanks folks. I finally figured it out - put $1 in double quotes thus "$1" as the input - works perfectly. I had tried this early on but it did not work. With hindsight I think i must have committed the cardinal error of changing more than one variable at the same time!
 
  


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
how to handle file names with spaces in them bahadur Programming 14 04-04-2005 01:04 PM
how to handle file names with spaces in them bahadur Programming 3 03-23-2005 06:15 AM
du or wc and file names with spaces bramadams Slackware 2 01-27-2005 12:43 PM
Bash crashes ? File names with () and spaces Danodare Slackware 1 02-27-2004 03:50 PM
File/Direcory Names with Spaces ar1 Linux - General 3 01-15-2004 11:41 AM


All times are GMT -5. The time now is 09:52 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration