Script problem


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Script problem
# 1  
Old 09-15-2008
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:

Code:
#!/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"

Code:
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

Last edited by Don Cragun; 02-21-2016 at 03:28 PM.. Reason: Change SIZE and I flags to CODE tags.
# 2  
Old 09-15-2008
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.
# 3  
Old 09-16-2008
Thank's "era" for your answer but it's not working.

This is a working script for the line with Maestro in it:
Code:
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

Last edited by Don Cragun; 02-21-2016 at 03:30 PM.. Reason: Add CODE and ICODE tags.
# 4  
Old 09-17-2008
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem in calling a script inside a script

Hi team, I have a script in different folder. Now i want to call that script and execute that script from that path alone. My code is #!/bin/bash wname=yahoo PATH='/opt/IBM' wac=`/usr/bin/ls $PATH | /usr/bin/grep "$wname"` STOP=`/usr/bin/find $PATH/$wac -type f -name "stop.sh"`... (8 Replies)
Discussion started by: natraj005
8 Replies

2. Shell Programming and Scripting

Shell script newbie, what is problem with my script?

Hello, Ubuntu server 11.10 can anybody help what is problem with my shell script? #!/bin/bash #script to find out currently logged on user is root or not. if ] then echo "You are super" else echo "You are awesome!" fi When I run script, I get following output ./uid: line 3: I... (4 Replies)
Discussion started by: kaustubh
4 Replies

3. Shell Programming and Scripting

Problem while calling a script within a script

Hi , I have moduled my scripts in three scripts . From First script i am calling second and from second i am calling third for some check . Problem is with the third script call. ---In second script EXP ='test.\abc.\Server.*abc.xml.*' pid=$($HOME/bin/checkpid $EXP) --Third... (2 Replies)
Discussion started by: amrishn
2 Replies

4. Shell Programming and Scripting

Problem running a program/script in the background from a script

Hi all, I have a script that calls another program/script, xxx, to run in the background. Supposedly this program at most should finish within five (5) minutes so after five (5) minutes, I run some other steps to run the script into completion. My problem is sometimes the program takes... (5 Replies)
Discussion started by: newbie_01
5 Replies

5. Shell Programming and Scripting

Problem with a script

Hi everyone, I got a problem with a script. What it's supposed to do is: to take as arguments a directory name <dir> and a dimension (in byte) <dim>; if <dir> exists, to write name and dimension of every regular file within it that sizes lesser than <dim> in regFileList. Nothing happens... (10 Replies)
Discussion started by: Luke Bonham
10 Replies

6. UNIX for Dummies Questions & Answers

Problem with script

Hello All. I have a script that is suppossed to start up a daemon but when executed, simply hangs. Could you please take a look and let me know where the problem might be? TIA ################################################################### # # SCRIPT: dstart3000.sh # Bring up the Domain... (6 Replies)
Discussion started by: grin1dan
6 Replies

7. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

8. Shell Programming and Scripting

ssh script problem problem

Hi Please help me with the following problem with my script. The following block of code is not repeating in the while loop and exiting after searching for first message. input_file ========== host001-01 host001-02 2008-07-23 13:02:04,651 ConnectionFactory - Setting session state... (2 Replies)
Discussion started by: pcjandyala
2 Replies

9. Shell Programming and Scripting

Help. Script problem

hey guys. i have a bunch of programs in a script that needs to run as root and the rest as another user, we'll call him gabriel. now, in this script, i want to run the first few lines as root. now, how do i, after running as root, tell the script to run the remaining lines as the user gabriel?... (3 Replies)
Discussion started by: Terrible
3 Replies

10. UNIX for Dummies Questions & Answers

Problem starting a script from a 'main'-script

Please Help! :o I have a main script (ksh) where another script is called (convert_picture). Normally this works ok, but since some changes has been made on the unix-server (I dont know what :( ) suddenly it doesnt work anymore: i get an error message: ksh: convert_picture not found. I am... (3 Replies)
Discussion started by: Rakker
3 Replies
Login or Register to Ask a Question