Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello, can anyone help by showing how the script should look to work under Mac OS!
Code:
#!/bin/bash
USR=$(logname)
f=`find /home/$USR/proba -name "*.doc" -o -name "*.xsl" -o -name "*.pdf"`
for file in $f
do
chattr +i $f
done
I want to achieve the same result!
Ok...so what happens when you run this on a Mac?? And you do realize that Mac OS is NOT Linux, right? So unless you have all the same utilities (that also take the same command-line attributes), the script won't work. Same with path names, etc.
Ok...so what happens when you run this on a Mac?? And you do realize that Mac OS is NOT Linux, right? So unless you have all the same utilities (that also take the same command-line attributes), the script won't work. Same with path names, etc.
I wrote this script myself, and I know the differences but I have not Mac on hand to experiment. I was hoping someone who has experience with Mac to help me because there is no way to check the result. To put it short I have no choice but to write someone for me. If you have no experience with this, do not write in vain. I wrote this script for 2 minutes if you know how and you have two minutes write/type the right commands!Please!
I wrote this script myself, and I know the differences but I have not Mac on hand to experiment. I was hoping someone who has experience with Mac to help me because there is no way to check the result. To put it short I have no choice but to write someone for me. If you have no experience with this, do not write in vain. I wrote this script for 2 minutes if you know how and you have two minutes write/type the right commands!Please!
There is no way anyone here can know what knowledge you have...we know what you post. You asked for assistance, and you were given a link and advice that could help you. Now you say that you know the differences (implying that you are experienced in Mac scripting).
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.
There is no way anyone here can know what knowledge you have...we know what you post. You asked for assistance, and you were given a link and advice that could help you. Now you say that you know the differences (implying that you are experienced in Mac scripting).
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.
#!/bin/bash
USR=$(logname)
f=`find /home/$USR/proba -name "*.doc" -o -name "*.xsl" -o -name "*.pdf"`
for file in $f
do
chattr +i $f
done
Well, your first problem is you're using "chattr +i $f" instead of "chattr +i $file".
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.