LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-14-2006, 08:49 AM   #1
nykey
Member
 
Registered: Nov 2003
Location: Tg-Jiu, Romania
Distribution: OpenSUSE 11.1 / echo "Windows XP" > Trash
Posts: 360

Rep: Reputation: 30
Basic programming language for Linux scripts


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.
 
Old 07-14-2006, 09:10 AM   #2
cdhgee
Member
 
Registered: Oct 2003
Location: St Paul, MN
Distribution: Fedora 8, Fedora 9
Posts: 513

Rep: Reputation: 30
Bash scripting - it's the native language of the Linux shell that most people use.

As for a guide, check out the advanced BASH scripting guide
 
Old 07-14-2006, 04:32 PM   #3
sporty
LQ Newbie
 
Registered: Oct 2005
Location: Austin, Tx
Posts: 18

Rep: Reputation: 0
Try the Bash-Beginners-Guide available at http://www.tldp.org/guides.html.
 
Old 07-14-2006, 06:22 PM   #4
LinuxLala
Senior Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: Fedora 7
Posts: 1,305

Rep: Reputation: 45
BASH scripting would be nice. It's easy to learn and yet very powerfull. Enjoy!
 
Old 07-14-2006, 06:35 PM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,377

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
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.
 
Old 07-14-2006, 07:58 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,271

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
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).
 
Old 07-14-2006, 09:34 PM   #7
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,087

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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.

jlinkels
 
Old 07-14-2006, 09:59 PM   #8
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,377

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
Quote:
Originally Posted by jlinkels
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 several ways to get the job done, and no one telling you (or maybe everybody telling you .. ..) that this way or that way is "correct."
 
Old 07-16-2006, 03:29 PM   #9
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
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?

Thanks,
Rand
 
Old 07-16-2006, 03:48 PM   #10
blackzone
Member
 
Registered: Jun 2004
Posts: 256

Rep: Reputation: 30
For linux, learn bash script and nothing else.

And only learn other scripting language when you "have to".

When you are forced to read/add/modify/debug 100,000 lines of installing script, the syntax of the language doesn't matter.
 
Old 07-16-2006, 08:03 PM   #11
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,087

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
[QUOTE=Randux]Where can we find this excellent, real excellent on-line TCL tutorial?

"On-line" is not entirely the right expression, I should have said: "interactive".

This is the interactive version:
http://www.msen.com/~clif/TclTutor.html#download

Here you find pointers to normal tutorials:
http://wiki.tcl.tk/1304

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.

jlinkels
 
Old 07-27-2006, 02:49 PM   #12
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
[QUOTE=jlinkels]
Quote:
Originally Posted by Randux
Where can we find this excellent, real excellent on-line TCL tutorial?

"On-line" is not entirely the right expression, I should have said: "interactive".

This is the interactive version:
http://www.msen.com/~clif/TclTutor.html#download

Here you find pointers to normal tutorials:
http://wiki.tcl.tk/1304

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.

jlinkels
Sorry, I didn't see your reply somehow.

Thanks for the info!

Rand
 
Old 07-27-2006, 02:58 PM   #13
PB0711
Member
 
Registered: Aug 2004
Location: London, UK
Distribution: Ubuntu 10.10, ubuntu 11.04, suse 9.2, OSX
Posts: 259

Rep: Reputation: 30
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 !
 
Old 07-27-2006, 06:57 PM   #14
SeekingWisdom
LQ Newbie
 
Registered: Feb 2006
Distribution: Slackware 10.2
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by sundialsvcs
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.
 
Old 07-27-2006, 10:01 PM   #15
fudam
Member
 
Registered: Feb 2006
Distribution: FC
Posts: 86

Rep: Reputation: 15
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.
 
  


Reply

Tags
python


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux programming language soulxcavtor Linux - Software 9 06-06-2006 01:23 AM
programming language for linux dipenchaudhary Linux - General 1 02-03-2006 11:57 AM
Beginning Programming, What Language To Use For Linux sovietpower Programming 21 02-11-2004 09:44 PM
Simple graphical linux programming language? Nerd2 Linux - Software 4 05-03-2003 07:12 AM
What is the best language for Linux/Apache Scripts? 360 Programming 3 09-16-2001 09:13 PM


All times are GMT -5. The time now is 09:28 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration