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.
Hi, this may sound a bit silly, but I was wondering, what language do you guys here suggest someone to start with for basic scripts in Linux, maybe post some guides, how-to's, ect... and what would be the next thing to learn afterwards. Thanks.
Bash scripting ... oh yes, great beginner's language. (ahem...)
Personally, I use Python. I don't mean to start any religious wars here, and it does depend in part on the nature of what you are doing. On the one hand, "Bash is always there." It's the shell you're using so the language is supported everywhere. (Unless you're using any of the half-dozen other shells... )
On the other hand, I at least find Bash scripts very difficult to use. The Python interpreter is readily available on my system and, although its curious "indentation is important" syntax is a bit hard to get used to, it's capable of doing pretty much anything you might dream of.
The Unix/Linux environments are very different from "what you may be used to" in that there are usually dozens of ways to do just about anything, and someone out there is using all of them. This is emphatically not an environment that has been dominated by "a single vendor."
Last edited by sundialsvcs; 07-14-2006 at 06:37 PM.
Another vote for bash - gotta start somewhere, and as said it's (usually) on the box.
Especially handy if you happen to wander onto different machines at various times.
I do all my "quick and dirty" tasks with it.
Easy enough to pick up another "language" later - but that's an entirely different can of worms (see "religious war" referenced above).
Well after two years Bash scripting, I feel I am now a beginner instead of a newbie. Sometimes I even get dollar signs and double and single quotes right the first time.
So Bash is nice.
If you want something more, like, try TCL, and TCL/TK for graphics. Not that TCL is such a great wonderful scripting language (well, actually it is), but it has an excellent, real excellent on-line tutorial.
Without it you are lost, but with it, I was able to produce (and understand) script the second day or so. Even moderately complicated like TCP comms, including RS error correction (well I copied that) and binary operations and so.
For programs which have to carry out a lot of shell commands I prefer bash. For complicated problems with almost no shell interaction I like TCL.
For programs which have to carry out a lot of shell commands I prefer bash. For complicated problems with almost no shell interaction I like TCL.
jlinkels
That might be a good "bright-line rule." If what you are doing is mostly to be done by carrying out a lot of shell commands, then bash-scripting is a great way to "bash" it out. But if what you need to do is more generally what would be done "by a true program," other scripting-languages might be a better choice. (But see last pp!)
This might be a good time to mention that Unix/Linux has a pretty good crop of unusual, task-oriented languages .. like 'awk' .. which can serve to eliminate the need for "a general-purpose program." For instance, in the case of 'awk', if what you are trying to do can be generally described as "ripping apart a text-file," here's a specialized (and extremely powerful) tool for doing it. Many of the tools that are available in this environment (and which usually have no corollary in the Windows world except where they've been ported) are like that.
The "Unix philosophy" of stringing together simpler tools to do complicated tasks is also something that is .. rather counter-intuitive at first, then .. extremely elegant. Many of the tools you'll find seem to be "just pieces of a whole" because they are, and are designed so to be. You get to know "Unix plumbing," with "pipes" and "tees" and so-forth. (And you start winding your way back to bash-scripts as a good means of using these tools...)
Throughout the Unix system(s) there are severalways to get the job done, and no one telling you (or maybe everybody telling you .. ..) that this way or that way is "correct."
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
Quote:
Originally Posted by jlinkels
If you want something more, like, try TCL, and TCL/TK for graphics. Not that TCL is such a great wonderful scripting language (well, actually it is), but it has an excellent, real excellent on-line tutorial.
Where can we find this excellent, real excellent on-line TCL tutorial?
The interactive version is fun: you can alter the code in the examples while in the tutor and see instant results. (I have never seen that before)
The tutor was written in TCL/TK as well, BTW.
The interactive version is fun: you can alter the code in the examples while in the tutor and see instant results. (I have never seen that before)
The tutor was written in TCL/TK as well, BTW.
I must say bash is a very helpful script language. I do a lot in Perl, it's a lot like bash and is fairly simple to learn if you know bash/programming. Also I think it works faster than bash.
Perl is almost an essential part of linux.
You knew someone was going to bring up Perl !
Bash scripting ... oh yes, great beginner's language. (ahem...)
Personally, I use Python. I don't mean to start any religious wars here, and it does depend in part on the nature of what you are doing. On the one hand, "Bash is always there." It's the shell you're using so the language is supported everywhere. (Unless you're using any of the half-dozen other shells... )
On the other hand, I at least find Bash scripts very difficult to use. The Python interpreter is readily available on my system and, although its curious "indentation is important" syntax is a bit hard to get used to, it's capable of doing pretty much anything you might dream of.
Beautifully said. That's exactly the point I was trying to get across in another thread, but apparently I went misunderstood.
Bash is obviously very useful, but to me it seems that many of the most common tasks a programmer needs to perform are often much more cryptic and difficult to implement in Bash. I believe Python is just easier to grasp, and that's why I think it's a better language to start with. Not to mention the options and syntax you'll probably wade through in the man pages of all the applications you're going to pipe together in your Bash programs.
I love Bash and I love Python - your mileage, however, may (and will) vary.
While is seems that bash scripting has won by sheer number, I have to disagree.
I personally find perl much easier and more enjoyable to program. I still use bash for quick scripts, but for anything larger than 3 lines I go perl. I suggest learning perl, and regular expressions. Then learn bash.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.