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.
So you have the commands and the additional qualifications for them (to pipe to grep)
I repeat something I've always said about bash scripts, which is
Quote:
Anything you can type into a command line, you can write into a bash script
Therefore, have you started a script? Do you know how to write a rudimentary bash script?
Please understand that LQ members are volunteers and we are happy to help you solve and/or refine a solution to your problem. But you need to execute that solution yourself, by writing a script and then asking members to help you if there are problems or to improve it somehow.
Please consider writing a script to do the command and then determine what additional things you want it to do. Note also that a single command is not necessarily helpful, and in fact you can more easily create an alias as opposed to writing a script. For a script, you likely would want to do other things. A script will work, but if your intent is to just make a shortcut for a command, then an alias may be better. Perhaps there are other things you intend to do or perhaps you intend to monitor this data regularly versus manually call it. Please update the forum with some additional information about this.
Hi
I want to create a script looking at the % used for the disk space for 3 specific filesystems I know the command df -h gives me the fileystems list etc but stuck on how I grep for the 3 filesystems
I want to grep for the 3 following: 1. /opt/ca
2. u50
3. u01
Glad to help; so what have you done/tried so far? Can you post your script and tell us where you're stuck? Read the "Question Guidelines" link in my posting signature.
I'd suggest storing whatever you want to look for in an array, and loop through the input to match those strings.
I know that what I have done above is filtering out the ones that I don't want but obviously this is quite a long winded approach, is there a quicker way?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.