Help translating code from Linux to OSX?
Hello,
I have the following code: Code:
#!/bin/bash It works fine when I'm running it on Ubuntu 11.04. However, when I try to run it on OSX, I get the following error: Code:
mh320m01:DA_R02 janickij$ ./MOD_Loop_Tuber_Script.sh Thanks. |
According to this (I don't run OSX) all your options are supported except -printf; perhaps try putting the directory it should search in after "find"? ie:
Code:
find . -type f -name '*.dx' Hope this helps, |
The tools in Mac OS X are from BSD and not the GNU ones. E.g sed I compile on my own to get the options I’m used to. You could try to compile and use GNU version.
In the BSD version you must specify a path (i.e. the . Snark1994 used), but in GNU it’s optional. |
Excellent! Thanks for the help. As an Ubuntu user for half a year, I despise OSX, but I have to make my programs work with OSX because that's what the lab I'm working in uses. :<
|
I've come across another problem with this. Here's my code now (the extra lines of code (from above) haven't been changed):
Code:
find *.dx -print | sort -n -t _ | while read protein && read water; echo $protein $water; do dx ; done The echo command shouldn't be causing the problem either, should it? Anyone know how to properly end this? |
Is there any reason why you read twice and not both variables in a single read?
|
I'm sorry, I don't think I understand your question.
I have these files: 0-protein.dx 0-water.dx 1-protein.dx 1-water.dx 2-protein.dx 2-water.dx ...etc....etc... The function dx takes two arguments, the protein and the water file, to output a new file: #-protein_out.dx. Do you mean, why isn't it while read protein water (or something like this?) instead of while read protein && read water I don't know. It worked on linux. It doesn't work on Mac. |
Oh sorry, I see the purpose of reading twice now. In your line the do must follow the condition I think:
Code:
ls *.dx | sort -n -t _ | while read protein && read water; do echo $protein $water; dx; done |
Well, the ls command worked just as well as find. However, the program still isn't terminating properly.
|
OH. The do echo part of the code is what was screwing it up. I had that in there to test if the find command worked okay on the Mac. Took that out, and it worked fine.
Thanks! |
All times are GMT -5. The time now is 07:15 AM. |