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.
Im new to bash scripting and i want to add a command line option where when a flag is used in the command it can omit some of the out put. I have a script that goes and lists all the disk partitions. I want to add to the script to omit what ever partition is chosen from the output.
No -o was going to mean omit and the partition list after would be stripped out. In the script there getopts, which i understand is the best way to go. So there is a flag to change the output from all to just one specific partition.
Last edited by investmentbnker75; 10-01-2008 at 10:49 AM.
Reason: change
Save the list of things passed to -o. The argument to -o will be a regular expression (like /local|/opt above). When it comes to output or process your final list, if there is an RE pattern saved (from -o), call {e}grep -v with the saved RE pattern on your data to be output.
I didnt get that to work, let me post this script which is similar to what i was asking which i need to do the same thing to. I added -o flag to it to omit the tablespace, i just need the actual function to make it happen.
Last edited by investmentbnker75; 10-01-2008 at 10:48 AM.
And point out where you want help in the code. Bold the sections you want help with. I'm not in the mood tonight to try to guess where help is required. :-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.