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.
I want to be able to do basic scripting tasks such as manipulating text files, directories etc. Making backup scripts and such as well as perhaps later on making functional programs.
I've looked at Python mostly and it seems it will fit my needs, however I was wondering if I wanted to manipulate files and directories on a UNIX system via Python am I not going to need to know BASH anyhow?
Manipulating files and directories (e.g. copying, moving, removing, appending to, &c.) you would want to use Bash. Python can do it, but it will take three times as much code. Shells rule for system administrative type tasks. But for general programming, definitely you will have to learn a language like Perl, Python, and Ruby. All three of the latter are great choices; I consider Perl more concise and better for smallish programs and Python better for larger systems, Ruby somewhere in between. But that's just my opinion so you'll just have to take a look at them to find out which one suits you best.
For manipulating text files you could use sed, grep or awk. I'm not sure if bash would be helpful learning python (apart from the fact that it's possible to run bash commands from within python programs) but knowing bash is generally very useful. Sometimes it may be quicker to do something in bash, sometimes python will do the job better, etc.
Quote:
How would Ruby and Perl compare?
I can't help you with it, but here is a thread about perl/python/ruby.
My actual "programming problem" lies with my ppp internet connection (USB).
Every now and again it would disconnect (it's wireless) and I would have to manually use "sudo pon neotel" to reconnect it again and I have to do sudo modprobe usbserial vendor=0x1d09 product=0x4000 every time after booting then sudo pon neotel.
Basically I want this to be done automatically via some script. It must automatically connect when I boot my comp and automatically reconnect when it has disconnected.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
For these kind of problems which lie closely to the OS, yes, use Bash. Probably you want to check you connectivity and undertake some action based on that. Something you now do manually on the command line, if you automate it, it is logical to do that in Bash.
See my signature for a link to the Bash programming guide.
I think you should also add Java to the list of languages listed by the other members above (vis-a-vis Perl, Python, and Ruby). Using it - you can all the things you wanted to do too!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.