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.
Since you just want to call other programs, why not just use shell scripting?
Also, im not sure you can pipe programs together like that, and im fairly sure that i see various shell commands within that command you are issuing, so i doubt it will ever run in C. Also, bb is not a string, but a single character.
And those errors seem to be coming from the compiler trying to compile that script, who knows what the compiler will make of it. Just use regular shell scripts instead, save yourself the trouble of debugging that.
If you wanted to be really hardcore, you could write out the function of each piped program you call in the system() function.
I have a copy of The C Programming Language by Kernighan & Ritchie, and over the first few chapters you learn how to make a program that does exactly this. Of course, it takes a bit of extra typing to get the functionality you are requesting of those other programs, but the fact is you learn HOW TO DO IT!
Which really makes me wonder why a script would be written in C, when the exact same script could be written in the locally-installed shell. Execution time shouldn't be anything to worry about when it comes to something simple like this.
If you're going to learn C (just saying, keep in mind), I found the best way was to mostly everything yourself, instead of relying on pre-written/compiled commands.
I remember reading somewhere (I believe on this very forum) that use of the system() call was greatly frowned upon. *shrug*
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.