Lipo doesn't work


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Lipo doesn't work
# 1  
Old 08-25-2009
Lipo doesn't work

Hi guys,
Am using lipo to merge ppc and i386 version of a static/dylib file based on "file type to load". I am working on Mac OS 10.5.6 and new to shell scripting. Please help me out.

This is my code.
Code:
echo "This file combine ppc and i386 file to form universal library"

echo "source Path: "
read path
echo "source Path1: "
read path1
echo "destination : "
read dest

echo "file type to load"
read exten

for iFile in `find $path -type f -name $exten`
do
    echo $iFile
    iFile1="${path1}${iFile##*/}"
    echo $iFile1
    destFile="${dest}${iFile##*/}"
   lipo -create $iFile $iFile1 -output destFile
done

echo "***   Done   ***"

It's say lipo can't load the file in iFile. I am trying to run lipo command.
# 2  
Old 08-25-2009

Does the file in $iFile exist?

Your script will fail if any of the filenames contain spaces.

Is $exten a complete file name or an extension? Could it contain wildcards?

Code:
find $path -type f -name "*$exten" |
 while read iFile
 do
    echo $iFile
    iFile1=${path1%/}/${iFile##*/}
    echo $iFile1
    destFile="${dest%/}/${iFile##*/}"
   lipo -create "$iFile" "$iFile1" -output destFile
 done

# 3  
Old 08-26-2009
Code:
find $path -type f -name "*$exten" |
 while read iFile
 do
    echo $iFile
    iFile1=${path1%/}/${iFile##*/}
    echo $iFile1
    destFile="${dest%/}/${iFile##*/}"
   lipo -create "$iFile" "$iFile1" -output "$destFile" # changed the last line
 done

I figured out the problem in my script ,
It generated this path
"/sw/lib/ImageMagick-6.5.4/modules-Q16/codersycbcr.a"
which should have been
"/sw/lib/ImageMagick-6.5.4/modules-Q16/coders/ycbcr.a"

Thank you very much. I normally feed exten wildcards "*.a" or "*.dylib". I need to make checks for file existence.

Quote:
Your script will fail if any of the filenames contain spaces.
I have faced that problem too. How should I handle white spaces in file paths?
# 4  
Old 08-26-2009
Quote:
Originally Posted by vishwesh
Quote:
Your script will fail if any of the filenames contain spaces.
I have faced that problem too. How should I handle white spaces in file paths?

Always quote variables.

Never use:
Code:
for file in $( some_command )

Always pipe the output of the command into a loop instead:
Code:
some_command |
 while read file
 do
   : do whatever with "$file" (not $file)
 done

# 5  
Old 08-27-2009
Thanks a lot.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

-ne 0 doesn't work -le does

Hi, I am using korn shell. until ] do echo "\$# = " $# echo "$1" shift done To the above script, I passed 2 parameters and the program control doesn't enter inside "until" loop. If I change it to until ] then it does work. Why numeric comparison is not working with -ne and works... (3 Replies)
Discussion started by: ab_2010
3 Replies

2. UNIX for Dummies Questions & Answers

Why doesn't this work?

find . -name "05_scripts" -type d -exec mv -f {}/'*.aep\ Logs' {}/.LogFiles \; Returns this failure: mv: rename ./019_0120_WS_WH_gate_insideTEST/05_scripts/*.aep\ Logs to ./019_0120_WS_WH_gate_insideTEST/05_scripts/.LogFiles/*.aep\ Logs: No such file or directory I don't know why it's trying... (4 Replies)
Discussion started by: scribling
4 Replies

3. Solaris

There is gcc but doesn't work !!

gcc packages are installed as is seen. # pkginfo | grep -i gcc system SUNWgcc gcc - The GNU C compiler system SUNWgccruntime GCC Runtime libraries # There is gcc in /usr/sfw/bin but It doesn't work. # gcc bash: gcc: command not found... (7 Replies)
Discussion started by: getrue
7 Replies

4. Shell Programming and Scripting

my script doesn't work :(

i have this script and when i ejecute it, the console tell me this " sintax error line 41 unexpected element "}" " is the sintaxis ok? #!/bin/bash if ;then { exit 0; } if ; then { sudo /etc/init.d/apache2 start; sudo /etc/init.d/mysql start; php5 & nautilus... (3 Replies)
Discussion started by: keiserx
3 Replies

5. UNIX for Advanced & Expert Users

remsh doesn't work

Hi, I need to use remsh inside a ksh script. The script would remsh to another machine (maybe different OS) and then execute commands. A Simple Script: #!/usr/bin/ksh remsh sun7656 -l myuser "cd /user.3/MyFolder; ls -lart" But this gives me the error: permission denied I also... (4 Replies)
Discussion started by: som.nitk
4 Replies

6. Shell Programming and Scripting

What to do when mtime doesn't work?

I have a folder that I need to search for new files and copy on the latest. I've been using "-mtime -1" in my command line but it doesn't seem to work. I've been meaning to fine a different script because files are dropped into the folder all day long and because of the -mtime, I've only be... (19 Replies)
Discussion started by: bbbngowc
19 Replies

7. Shell Programming and Scripting

Awk: Can anyone tell me why this doesn't work?

If there exists a field in stdin, print it, otherwise, print hello..... These print nothing: cat /dev/null | awk '{if ( length > 0 ) print $1; else print "hello"}' cat /dev/null | awk '{if ( $1 ) print $1; else print "hello"}'But the scripts work if I run them directly in a terminal: ... (8 Replies)
Discussion started by: ksheller
8 Replies

8. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

9. Shell Programming and Scripting

sed doesn't work

Hello I' m confused a bit. I want to replace string "&amp" with "&" using this command. sed 's/&amp/&/g' and it doesn't work. Nothing happens. On the other side this works: sed 's/&amp/@/g' or sed 's/&amp/^/g' !!! Can somebody help please? Thanks (3 Replies)
Discussion started by: billy5
3 Replies

10. Shell Programming and Scripting

Why doesn't this work?

cat .servers | while read LINE; do ssh jason@$LINE $1 done exit 1 ./command.ksh "ls -l ~jason" Why does this ONLY iterate on the first server in the list? It's not doing the command on all the servers in the list, what am I missing? Thanks! JP (2 Replies)
Discussion started by: jpeery
2 Replies
Login or Register to Ask a Question