PDA

View Full Version : c++ linux



cessna_89702
April 14th, 2007, 07:28 AM
Is it possible to use c++ for things that writing shell scripts can due?
Like is it possible to write a c++ program and then compile & run it that will do something like "sudo apt-get program" rather then writing shell scripts to do it

amohanty
April 14th, 2007, 07:47 AM
Yes, look at the dpkg-dev package. However that would be far more complicated than shell scripts. What are you looking to do that you cannot do with either bash, perl or python scripting?

AM

cessna_89702
April 14th, 2007, 08:09 AM
I dont really need to I was just wondering because I am much better in c++ then I am in like perl and stuff

aquavitae
April 14th, 2007, 08:32 AM
I usually use bash scripting for stuff like that. But I know what you mean about c++, I'm also much more comfortable with it then anything else! However, the only way to get good at it is to use it, and there's plenty of examples to help you (/bin, etc). If you really want to use c++, I think the c libraries have quite of lot of the functions you're looking for, but it ends up much more complicated than just learning bash.

phossal
April 14th, 2007, 08:13 PM
Oh, man, learning perl or python to do basic chores is pretty simple. And you can solve most of your bash woes in a day or two by reading Oreilly's book, "Learning the Bash Shell". Even if you only get through a chapter or two, you'll be so much better off.

I love c and c++, and I generally use the tools I'm most comfortable with, but I wouldn't knit my own socks if you know what I mean. You may have a solid reason to learn a new skill. Embrace the opportunity. Most of us have to think of reasons to learn new stuff.

Just ask the guy writing a web server in c++. ;)

pmasiar
April 15th, 2007, 01:01 AM
I agree. IMHO you will learn faster basic bash than tricks and libraries needed to do that in C++.

amohanty
April 15th, 2007, 06:20 AM
TLDP is a great resource too:

http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html

It also has an advanced bash guide that may come in handy

AM