Bash ,to work under MAC OS
Hello, can anyone help by showing how the script should look to work under Mac OS!
Code:
#!/bin/bash |
Quote:
If you want to know about Mac shell scripting, Apple has a scripting tutorial...have you read it? http://developer.apple.com/library/m...roduction.html |
Quote:
|
Quote:
If you want someone to do work for you, then you need to pay them. Otherwise, you need to do the work yourself...this is true for ANYTHING, from writing a script, to painting a house. Otherwise, you can find a friend with a Mac, or buy one, and do it yourself. There are even options for you to get Mac OS running in a virtual machine, which you can find on the Internet. Those are three options for you to do it yourself; if you want someone to do it for you, post the job in the LQ Job Marketplace. And if you're going to reply rudely when people offer you help, you probably won't get people offering to help you, much less do work for you. |
"Mac OS" (as in System-9) is not Unix-based. OS/X, however, is.
OS/X is based on the Mach (BSD Unix) kernel, not Linux, and although many of the commands are similar, they are not entirely. |
Quote:
|
Code:
#!/bin/bash But more importantly, you've fallen for the incredibly common Don't Read Lines With For error. This is compounded by your attempt to store the output of find inside a single, scalar variable. Finally, you need to learn how to properly quote variables, a vital concept in scripting. http://mywiki.wooledge.org/Arguments http://mywiki.wooledge.org/WordSplitting http://mywiki.wooledge.org/Quotes Instead of for, use a while+read loop, preferably with -print0 null separators (be sure your version of find supports it). Code:
while IFS='' read -rd '' fname; do http://mywiki.wooledge.org/BashFAQ/001 And here are a couple of good links about using find: http://mywiki.wooledge.org/UsingFind http://www.grymoire.com/Unix/Find.html PS: $(..) is highly recommended over `..` |
@David the H. Thanks for the good advices!
|
All times are GMT -5. The time now is 12:54 PM. |