LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-13-2003, 08:23 AM   #1
Cyth
Member
 
Registered: Mar 2001
Location: Sweden, Lund
Distribution: Slackware
Posts: 68

Rep: Reputation: 15
Misc shell questions


Hi all,

I have some miscellanous shell questions:

1.
I am writing a set of scripts that handles file/dir names containing spaces. No matter what I do I find this a true mess. Ie, I pass as argument to another script a path(which happens to contain spaces) and it separates into several $1,2,3... How do I handle filenames with spaces in an generic and efficient way? Or should I just give up?

2.
I want to change the comments fields of an ogg file. This is possible if you encode a wav file to ogg with oggenc but how do yu do it when you already have an ogg file? From a shell script that is..

Any ideas?

cheers,
Cyth
 
Old 03-13-2003, 10:31 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
how are you passing these variables to the other script? to deal with spaces in filenames you can always just enclose the name in quotation marks or escape the spaces with leading \ signs. there are ways i keep seeing on here that use read to split by newlines, or you can use the shells IFS variable:

Code:
chris@trevor chris $ ls -1 tmp/
file 1
file two
file_three
chris@trevor chris $ for j in `ls -1  tmp/*` ; do echo $j; done
tmp/file
1
tmp/file
two
tmp/file_three
chris@trevor chris $ IFS="\n"
chris@trevor chris $ for j in `ls -1  tmp/*` ; do echo $j; done
tmp/file 1
tmp/file two
tmp/file_three
chris@trevor chris $

Last edited by acid_kewpie; 03-13-2003 at 10:36 AM.
 
  


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
Misc. Questions About 10.2 Duo Secundus Slackware 1 09-29-2005 06:40 AM
Misc Questions OlRoy Linux - General 3 12-09-2002 07:03 PM
Misc Questions.... ugenn Linux - General 2 06-27-2002 02:00 PM
Misc. Linux questions. ugenn Linux - Newbie 7 04-16-2002 10:42 AM
More Misc Linux Questions... ugenn Linux - Newbie 4 04-16-2002 10:38 AM


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