Distinguish from the contents of a file which are the processes and print them
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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 have a file with name procs and the following content:
date
httpd
ps
tty
.....
how can i recognize which of these names are processes names and print only them
My solution is
for i in procs
do
if [ -p $i]
echo $i
done
but is does not work. I would appreciate any help.
Why do you consider this a solution? What do you think should
be happening, what do the man-pages for the programs involved
in your "solution" suggest they do, what is the outcome of your
attempt?
Seriously, tell me the 3 CLI ways to get documentation on a command, & I will tell you which one to use to solve your problem.
Welcome to LQ
Welcome to LQ. Yes, I mean it. I know others have been pretty harsh on you for posting your homework, but in the process they have provided much amusement for the rest us: Find all threads started by jianelisj
Thank you for the wonderful light start to my day.
Proves the old adage: "No one is completely worthless -- you can always be used as a horrible example.
For the moment, you are the horrible example; however, in amongst negative commentary are the seeds of reform -- re-read & learn.
Surprisingly, one thing no one has suggested is Raymond & Moen's "How To Ask Questions the Smart Way" found here or here. (Both of the authors maintain public copies.)
Finally, if you would really like to become a valued, contributing member of LQ, consider the following voluntary homework assignment:
Find the LQ Rules.
Paste them into an editor.
Annotate each original paragraph with an explanation, in your own words, of what it means. The point is to clearly demonstrate that you understand.
Clearly mark the added material.
Make yourself an LQ blog.
Post this assignment there, consisting of:
This list.
The steps to accomplish each one.
The resulting Annotated Rules.
Scoring will based primarily on demonstrating that you understood what you read.
Grammer & spelling count.
Extra points for eloquence.
Last edited by archtoad6; 03-19-2008 at 09:26 AM.
Reason: unfinished, posted accidently
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.