LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 01-14-2004, 09:59 AM   #1
welby
LQ Newbie
 
Registered: Jul 2003
Posts: 7

Rep: Reputation: 0
Bash scripting question.


I use a script to generate a list of files for a backup process. The script find the files then ports the file names to a text file, which the rest of the script uses as a reference for the backup operation. Here is my problem:

The servers I'm backing up are a combination of Windoze and Novhell and both support long file names. When the script reads a long file name or directory with a space in it the file copy fails. I'm guessing that if I add quotation marks to the list of found files it will copy correctly, so the question is this: Can I have a script add quotation marks to the beginning and end of each line in a file? It can be done either as a separate script or, preferably, as part of my current script.

Relevant data:

This is the portion of the script that searches for files:

find $SOURCE_PATH > $TEMP_FIND_FILE

cat $TEMP_FIND_FILE |\
while read FN; do

The "do" is a bunch of meaningless junk that will make no sense unless you have a DVD library.

A typical SOURCE file looks like this:

/mnt/SERVER/DATADRIVE/DIRECTORY:/BACKUP/DATE/SERVER:

A typical "find" output looks like this:

/SERVER/DATADRIVE/DIRECTORY/filename.doc

I'd liek the output to look like this:

"/SERVER/DATADRIVE/DIRECTORY/filename.doc"

Any help would be gratly appreciated.

-welby
 
Old 01-14-2004, 11:05 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
echo Some_text | awk '{printf "\"%s\"", $0}'
 
  


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
Bash Scripting Question fiod Linux - Newbie 4 11-19-2005 06:09 AM
Bash scripting question ajaye1971 Linux - Newbie 1 11-16-2005 08:29 PM
Bash scripting question. pete1234 Programming 23 09-22-2005 07:52 PM
bash scripting question mehesque Programming 2 03-07-2004 02:37 PM
Bash Scripting Question RefriedBean Programming 6 09-11-2002 10:06 AM


All times are GMT -5. The time now is 12:54 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