PDA

View Full Version : bash or Python ?


daviddutch1964
02-23-2007, 12:25 AM
I'm looking for opinions here.

Which would you suggest I learn first – BASH or Python? I have been flip-flopping on this for a long time now. :confused:

I'm wondering which I should dive into and learn first, BASH (shell programming + AWK & sed) or start with Python? I have no urgent need in my job to learn either or any programming. This is purely out of self interest.

A bit of history – I started with computers back in high school with a VIC20/C64 and programmed a lot in BASIC – the ONLY programming language I have had any real experience with. I loved it. For the past 10 years i have been running a computer networking within a public library and not had much call for any kind of programming other than HTML and hacking up someone else's Perl code (of which I know nothing)...

I run Linux and of course windows is everywhere.

The practical part of my brain... :rolleyes:
tells me it would be a good thing to sit down and learn BASH. Seems every network admin knows and relies on shell and its tools. I haven't had to do much messing with this in the past 10 years. I run debian. :) I have noticed people who work on shell scripts really never sat down and learned it – it came from already understanding another programming language.

The nostalgic part of my brain... :D
is excited at the thought of learning something that not only has some sys admin value, but also the ideaof a possibility of learning through simple game programming (from my BASIC C64 days) that some “teach yourself python” books is an attention-getter for me. And of course the promise of Python being easy to learn and and understand a good place to start.


So I have no “need” in my job right now for either or any programming. I just occationally edit text files that other programs use. Learning bash or python is only out of interest and to maybe one day to benefit me in work.

Which would you suggest I learn first – BASH or Python? I have been flip-flopping on this for a long time now.

Spookster
02-23-2007, 12:53 AM
I wouldn't use bash to try to learn programming. Python would be a better choice of the two although python is not the best choice either. If you really just want to learn programming I would stick with a scripting language and you can start with javascript or even PHP. Once you have a general understanding of how to program it is easier to apply that to a shell scripting language such as bash. You can also use Perl.

ralph l mayo
02-23-2007, 02:30 AM
Take a look at Ruby, it's somewhat of a mix between bash and python, having inherited a lot of sysadmin type stuff from perl which originally lifted it from bash and its core utilities and also having pythonesque pure-OO semantics. Ruby vs. Python is more of an aesthetic distinction than anything though; go with what appeals to you. Learning to program with bash sounds horrific.

edit: also awk and sed really should be deprecated by now... an ounce of Ruby, Python, or Perl on the command line is worth 15kg of O'Reilly books on awk and sed.

daviddutch1964
02-23-2007, 03:04 PM
Python IS a scripting language. And from this point, can be considered the same as Perl. so the questions would really read "should I spend the time trying to learn bash scripting or some higher level scripting language?"

so far it seems Python would be the way to go.

~d

Spookster
02-23-2007, 09:52 PM
Python IS a scripting language. And from this point, can be considered the same as Perl. so the questions would really read "should I spend the time trying to learn bash scripting or some higher level scripting language?"

so far it seems Python would be the way to go.

~d

I never said that Python was not a scripting language. I know that Python is a scripting language I use it at work. Other than the fact that they are both scripting languages Python is most definitely not the same as Perl.

Higher level scripting language? lol umm ok

Aradon
02-24-2007, 03:34 PM
Scrap both and use Java ;) (just kidding obviously)

Well in terms of the topic, all I can contribute is that when I left my undergrad about a year ago, they started this new thing. For the people that couldn't make it in our beginning programming class of Java, they would put in a Python programming class, that would introduce the concepts slower and in a more "friendly" language.

I haven't used Python, but from what I hear it wouldn't be a bad idea to learn Python to move onto messing with Bash Scripts. I have used Bash a lot in my networking "minor" (It's really a sub concentration on my degree but I digress), but I first learned Java, then Ada, Then Perl, then started on Bash.

And just to add a last note, you should take ahold of the day and do something that you want to do, rather then something that sounds "practical." After all, if you're excited about it, you're more likely to learn it and remember it.


Denny Duquette: I've been lying in this bed for close to a year, and I've had a lot of time to look back on my life. And the things that I remember best - those are the things I wasn't supposed to do and I did them anyway. The thing is, life is too damn short to be following these rules.

YAY Grey's anatomy!

Okay I'm done. :P

Spookster
02-24-2007, 04:41 PM
One of Python's biggest mistakes is that they decided to use whitespace to designate the end of code blocks. They took a step back in programming language evolution. That makes for incredible poor readability and writability of code.