The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ssh script problem problem pcjandyala Shell Programming and Scripting 2 07-31-2008 12:27 PM
Problem With script FLABITS Shell Programming and Scripting 3 03-30-2008 09:34 AM
Problem in Script ! varungupta UNIX for Advanced & Expert Users 3 03-22-2007 04:58 AM
script problem tdavenpo Shell Programming and Scripting 3 01-04-2006 01:07 PM
Problem starting a script from a 'main'-script Rakker UNIX for Dummies Questions & Answers 3 06-28-2005 05:12 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-15-2008
Registered User
 

Join Date: Feb 2008
Posts: 8
Script problem

Hi, I need help with a script.

I posted a thread about this earlier this year with the title "Processing extended ascii character file names in UNIX (BASH scipts)". This script is new and is doing the same thing. It's a little bit different so I can't use the erlier one that Robotronic helped me with. It need to be altered to function.

The script goes:

#!/bin/bash

APP_VOL=$3
echo "APP_VOL="$APP_VOL
if [ "$APP_VOL" == "/" ] ; then
APP_FOLDER="/Applications/Finale 2009"
else
APP_FOLDER="${APP_VOL}/Applications/Finale 2009"
fi
COMP_FOLDER="${APP_FOLDER}/Komponenfiler"

cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/ensembles.txt" "${COMP_FOLDER}"
cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/instrument.txt" "${COMP_FOLDER}"
cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/MacSymbolFonts.txt" "${COMP_FOLDER}"
cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/pagesizes.txt" "${COMP_FOLDER}"
cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/Maestro Font Default" "${COMP_FOLDER}"
cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/Jazz Font Default" "${COMP_FOLDER}"
rm -rf "/Library/Application Support/MakeMusic/Finale 2009/Components/"



I have to make the lines 6 and 7 like this in order to use the word "filförval"

cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/Maestro filf\0303\0266rval" "${COMP_FOLDER}"
cp -R -n -p "/Library/Application Support/MakeMusic/Finale 2009/Components/Jazz filf\0303\0266rval" "${COMP_FOLDER}"


I think I need a echo command here in order to get it to work. If I use the letter "o" instead of "ö" it work alright.

Can anyone help me? Robotronic?

Thank's

peli
Reply With Quote
Forum Sponsor
  #2  
Old 09-15-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
The way the Mac encodes characters in a file name are different from the settings for your shell. The Mac uses something called "fully decomposed" Unicode which is different from the UTF-8 encoding you are using in the examples. If you can find the correct representation (perhaps with tab completion?) your script should work. Or as a workaround, simply use a wildcard to skip over the character you can't type (unsure whether "filf?rval" or "filf??rval" should work; depends again on the encoding I guess. "filf*rval" should certainly work, at least.)

Samma på svenska.
Reply With Quote
  #3  
Old 09-16-2008
Registered User
 

Join Date: Feb 2008
Posts: 8
Thank's "era" for your answer but it's not working.

This is a working script for the line with Maestro in it:
x=$(echo -e "/Library/Application Support/MakeMusic/Finale 2009/Komponenter/Maestro filf\0303\0266rval")
cp -R -n -p "$x" "/Applications/Finale 2009/Komponentfiler"

I can't use "${COMP_FOLDER}" to get the folder name, just the actual folder name (Komponentfiler) to make it work.

peli
Reply With Quote
  #4  
Old 09-16-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
I don't think we understand each other properly. What I'm saying is try

Code:
components="/Library/Application Support/MakeMusic/Finale 2009/Components"  # just to make this shorter
cp -R -n -p "$components/Maestro filf"*"rval" "${COMP_FOLDER}"
cp -R -n -p "$components/Jazz filf"*"rval" "${COMP_FOLDER}"
Theoretically, the wildcard character * could match a lot of other strings, so if you have "Maestro filförfattarval" and "Maestro filfrval" in the same folder, it would copy those too. If that is a real problem for you, you could try to come up with a less general wildcard such as ?? or ? instead, but I guess you won't have to. How many ?:s to use depends on how exactly the file name is encoded. What I was trying to say is that \0303\0266 is probably converted to a display string (this is the UTF8 sequence for the character ö, represented in octal notation) which does not match how the file name is actually stored in the file system (which is probably something like 006F 0308 in hex, according to the decomposition information at Unicode Character 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)).

I know nothing about Mac filesystems so I may be out on a limb as far as the theoretical side goes, but the workaround should hopefully help at least.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0