LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-22-2013, 12:01 AM   #1
danimalz
Member
 
Registered: Jul 2005
Location: West Coast South, USA
Distribution: debian 3.1
Posts: 267

Rep: Reputation: 36
Best path to programming skill


So, I've been using linux for a long time now, but have avoided programming because it makes my head hurt a little bit.

I often have some tasks that i KNOW would be very easy if i could write simple programs to automate things. For example, right now i wish i could write a simple program to search/replace specific simple text strings within many multiple text files.

I am VERY comfortable with CLI, but i just FAIL to successfully endeavor to write scripts/programs.

So my question is, now that i am seriously considering the effort:

Since i will never be a programmer, professionally, and since i just want some skills to accomplish random tasks from time to time:

What should i endeavor to learn amongst the following skillsets:

1. Shell (bash) scripting
2. Perl
3. Python
4. ???

As an adjoinder, it would be a bonus for me if the option i should undertake would become a foundation for a broader usefullness down the road - ie - is any of these choices more extendable towards future undertakings.. (?)

Just looking for experienced advice in this context.

Many thanks in advance to you fine folks,
cheers.
danimal
 
Old 11-22-2013, 12:50 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
the only thing I can say is just start to implement your first app and collect all the information you need to complete it. read man pages and tutorials about similar tasks, post your tries and we will gladly help you discuss it.
the first tool should be bash and the basic toolset: grep, sed, ls, ....
 
Old 11-22-2013, 02:27 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
http://www.tldp.org/LDP/Bash-Beginne...ers-Guide.html
Has a section about shell scripting. Check out tldp.org for some more advanced bash programming tutorials.

Bash will get you aquaintaned with basic programming concepts. Like loops variables and functions. Not talking syntax here due to bash from my perspective is a bit of from other programming languages when it comes to the characters used. And there are o so many different ways to write one and the same thing. Also this holds true for most other programming languages.

Perl would be the next step in my opinion cause most distributions bring it natively. Another point for perl is the massive load of libraries you can find on cpan.org. So if you want some bigger projects this might suite quite well.

As I only used python for blender I can't tell you mutch about it and if its suited for system tools. But what I know that its quite capable itself and easy on the syntax.

To run it down. Get your feed wet with bash.
 
Old 11-22-2013, 09:16 AM   #4
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
My standard advice to anyone starting to program is pick a language, (almost) any language, grab some basic documentation a tutorial (or two, or three...), and start writing. Having programmed in many languages while mastering few, I'm always searching docs and tutorials for assistance and useful tidbits.

For the specific problem of search/replace in multiple files, I'd go with pan64's recommendation
 
Old 11-29-2013, 05:42 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Seeing as the usual shell env on Linux is normally bash, I'd recommend starting with that and associated one liners from sed, awk.
Later on, probably Perl for longer/more complex tasks.
(Of course others will suggest their own favourite langs.)

These may help
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

For bash I recommend starting each script with
Code:
#!/bin/bash
set -xv
The latter line is the debugger; shows you everything that's happening; remove when you've got the script working.

http://perldoc.perl.org/
http://www.tizag.com/perlT/index.php
http://www.perlmonks.org/?node=Tutorials

One piece of advice; start with very short/simple scripts and only try to write & debug a few lines at a time.
Don't(!) try to write eg a 20 liner and then debug it into existence/working condition.
 
  


Reply


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
[SOLVED] Does anyone know good programming skill improvement books in linux C/C++ Ajit Gunge Linux - Newbie 4 05-27-2009 05:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration