LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 05-17-2006, 04:30 AM   #1
papiseckfr
LQ Newbie
 
Registered: Oct 2005
Location: Dakar Senegal
Distribution: redhat 9, debian amd64
Posts: 12

Rep: Reputation: 0
shell programming : problem with directory name with whitespace


Hi all,
i'm writing a simple shell script that change directory permission in a recursif way.
but i do have a probleme with directory name or file name that have whitespace.
this à sample using echo
Code:
./echo.sh  /home/partage/test/Users\ et\ Mail\ au\ test/
and for the script
Code:
 /home/partage/test/Users is a directory
et is a directory
Mail is a directory
and so and so
what can i do to indicate that th entire name of the directory is Users\ et\ Mail\ au\ test/ but not any subsection defined by whitespace
thanks in advance
Any help is welcome
 
Old 05-17-2006, 05:41 AM   #2
nukkel
Member
 
Registered: Mar 2003
Location: Belgium
Distribution: Hardened gentoo
Posts: 323

Rep: Reputation: 30
Put this line at the start of the script:
Code:
IFS=$'\n'
This will cause Bash's "Internal Field Separator" to be changed from the default (' ') to the newline character.

Esperant d'avoir aidé,
nukkel
 
Old 05-17-2006, 09:06 AM   #3
papiseckfr
LQ Newbie
 
Registered: Oct 2005
Location: Dakar Senegal
Distribution: redhat 9, debian amd64
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you very much
it work know smoothly
c'est sure cela à beaucoup aidé (je me fatiguais avec des programmes comme awk et sed )
 
  


Reply



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
Making find do search in a directory that has whitespace in its pathname xode Linux - Software 2 04-18-2006 10:42 AM
shell programming problem ratul_11 Programming 6 12-20-2005 07:29 AM
shell programming problem ratul_11 Programming 2 12-15-2005 12:05 AM
shell programming problem ratul_11 *BSD 2 12-14-2005 12:47 PM

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

All times are GMT -5. The time now is 08: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
Open Source Consulting | Domain Registration