ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
I'm using the find command to check for certain things, and exporting it to a text file.
what i would like to do from within a script, check that file and if it's empty then print success or no problem found. But if there is any thing returned from the find command then echo "hey problem, look in this file".
Code:
# find all files with no owner
find / -nouser > no_owner.txt
# if find command returns nothing, or the file no_owner.txt is empty then
# print no problem
# else
# print Files with no owner found! see no_owner.txt
# endif
I'm using the find command to check for certain things, and exporting it to a text file.
what i would like to do from within a script, check that file and if it's empty then print success or no problem found. But if there is any thing returned from the find command then echo "hey problem, look in this file".
Code:
# find all files with no owner
find / -nouser > no_owner.txt
# if find command returns nothing, or the file no_owner.txt is empty then
# print no problem
# else
# print Files with no owner found! see no_owner.txt
# endif
Ok, so can you post what you've written/tried on your own? We're happy to help with a problem, but we're not going to write it for you...you've posted a single find command, with a list of things you'd like to do.
There are MANY easily-found scripting tutorials...along with over 365,000 hits for "bash script to find empty files" in Google, which point you to examples.
if i bothered to look at the man page, i would not have bothered posting here asking about it.
And if you bothered reading the Question Guidelines, you'd see you should have. We aren't going to give you handouts....if you can't be bothered, neither can we.
"Help" is YOU doing work too. You're asking for a handout, and seem proud of it too. If you're too lazy to even read a man page, then hire someone to do your work for you and pay them.
2. Above would imply you know how this site works and what sort of things people will come back with
3. You have advised how lazy you are because in your own words :- "if i bothered to look at the man page, i would not have bothered posting here asking about it."
4. Instead of looking at the man page, which I suggested being that you are supposedly an experienced user based on number of posts, you would rather search the forum to point out someone else's post from 6 years ago
5. Hard to tell if the OP in post you have cited had many posts by the time they asked the question, but in answer to yours, yes I would have asked if they had read the man page first, if they say yes then I would point out the prune option and if not (or "I can't be bothered") I would suggest they do before getting help
6. gee 9pm and here i was up all night and answered your post at 5am my time, not sure how this has any bearing on the question
7. closing the forum would only disadvantage those users who actually want help
I'd thank you not to waste your time or ours by learning something here.
We are not here to spoon-feed you.
This is not Burger King. You don't get it your way.
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,600
Rep:
ron7000,
The behavior you're exhibiting and language you're using in this thread isn't acceptable here at LQ. You may want to read http://www.linuxquestions.org/questi...#faq_lqwelcome and the LQ Rules again if you're interested in participating here moving forward.
Code up a test using that. If you have problems, then post your code and a clear description of your problem as follow-up.
I'm hoping that you don't wait till the last minute and get very frustrated for all things you work on. And if you regularly do work at 9 PM, then complaining about putting in effort is the last thing you wish to do at that time is rather non-charitable.
Note also that having the forum root point out your bad behavior is embarrassing. Or should be. Instead of getting angrier, please learn from it. I'm likely much older than you and I still feel I learn from people.
all i needed was some basic code,
in fact all it amounted to was the if then fi syntax using an -s command.
if someone posted that code... then someone said hey that's not bad but consider coding it this way and posted some code,
is this not a programming forum?
it would have helped me.
but no, everyone on their high horse like we're in a classroom tells me to look it up on the web and do the work myself.
Quote:
This is not Burger King. You don't get it your way.
Show some maturity.
my response was frustration. I was going to respond the next day but i would have tested your profanity filter.
here's my mature response, you guys have a nice life.
jeremy, you just a lost a member.
you can delete my account here, this site is not helping me anymore.
feel free to delete anything i have ever posted here, especially if it contained code.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.