Member Avatar for chudapati09

I have some scripts on my server which I use to maintain it. Some deal with NginX, others with backups, some with user creations, etc. I've written all of these with bash, and it has been working perfectly. But these scripts have become really big and it become really hard to maintain with bash. So I'm thinking of rewriting the scripts in a different language. But I didn't know which language was the best to use with linux.

I use a lot of shell commands, so a language that works well with shell commands would be ideal.

Recommended Answers

All 4 Replies

I'm quite fond of Python. It's dead simple to learn; it's very easy to call normal commands as well.

commented: I've played with python a little, but the formatting really bugs me. But I wouldn't mind looking into it again. +1

This is a subjective question; you will likely only get opinions as answers.

My opinion is that Ruby is very nicely geared to this type of work. Perl is probably the most popular but I find the syntax prohibitive and Ruby grabs many of the most useful features from Perl while providing a much nicer syntax.

Here are a few reasons why I like Ruby:

  • Ruby is easy to learn. It is intuitive and has a good deal of availble libraries
  • There is support for regular expressions built into the language - no need to manually create a distinct object to handle regex
  • You can 'shell-out' using backticks (thus providing an interface to the tools you already have)

I'd suggest that if you don't already feel confortable enough with another language to choose it outright that you investigate (at least a little bit) each of teh responses you get here and decide for yourself which is best suited to your goals and comfort level.

Member Avatar for HTMLperson5

Python works well on Linux, you might want to give it a try. I recommend Python 2.7. There is no documentation source for Python 3 (Not a very good one anyway) so I advise you do not use Python 3.

Agreed that this is very subjective.

Python is my choice whenever I'm looking for something more than simple backups or file manipulation. HTMLperson5 is correct in that you want to stick with python 2.7.

BEst thing about python are the libraries of add-ins. Whatever problem you are looking to solve, chances are someone has already shared a solution that you can include in your solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.