LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 09-14-2010, 01:24 AM   #1
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Rep: Reputation: 53
Question Educational Bash projects


Have you ever seen a hobbyist electonic Kit? They have projects that try to teach what each type of component does. Is there such a thing for Bash? It would tend to be aimed at tasks that are suitable for bash and not attempt to go over the line of what is better suited as a compiled program. Intuitively I think maybe something that timestamps files; when you download them, or anything else that would keep a home PC better organized is practical. Any ideas or feedback would be appreciated!
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-14-2010, 03:34 AM   #2
rcbrgs
Member
 
Registered: Aug 2010
Posts: 30

Rep: Reputation: 14
I guess pretty much anything can be automated by clever shell scripts. So to come up with tasks you can have as a rule of thumb "how do I do X automatically?"
 
Old 09-14-2010, 09:22 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
How about scripts to backup files, to test Internet connectivity (and identify failing link or report external IP if Internet is up), to test response of a list of DNS servers, to delete temporary and cache files (could be dangerous!), to report any file systems more than some percentage full? For better teaching these scripts could a) trap all errors b) accept command options with/without option arguments (use getopt or getopts) c) read configuration data from a configuration file d) include an option (usually -h or --help) to print extended help e) ensure there is no other instance of the same script running.
 
1 members found this post helpful.
Old 09-23-2010, 05:26 PM   #4
smeaton
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Rep: Reputation: 1
This may be off point, but there is a small linux sys., called inx (inx-1.1.iso)that is
designed to teach the command line,it's text only and very well designed for learnig
the cli. -- smeaton
 
1 members found this post helpful.
Old 09-23-2010, 05:56 PM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Some good suggestions above. Catkin has the right idea - bash is perfectly suited to doing simple or even very complex system admin tasks such as one might want to do on a somewhat regular basis on their own machines. Many regularly scheduled tasks that are done by cron daemons are shell scripted. Just look around your machine and think about what you do regularly that makes you "wish you has a simple way to do this every time I do it!".

When I first got interested in learning bash, I began with a rather large shell script written by someone else; it was for configuring an iptables firewall - and I understood very little of what I was reading when I opened up the script in my editor. I started just perusing through it, editing comments for grammar; comparing comments to the code that they referred to, and trying to understand how that piece of code did what the comments said it did. This procedure got me a little familiar with syntax, and once I began to understand syntax, I began copying chunks of the code into my console and running them standalone, to see what they did. I'd adjust or change something, and try it again. Trial and error basically, but I find (for me anyhow) it's more productive learning this way than to copy examples from tutorials and run them. Tutorials are great for basic basics, for concepts, but for real usable situations, they aren't always the way to go.

Coming back to the "what do I need on my machine" thing.. Another example for me was needing a way to stop, re-configure, and restart the network on my firewall machine every time our dialup connection either came up or went down. There wasn't a script I could find that did precisely what I needed, and (using kppp at that time) KPPP did not have enough flexibility to do what I needed on its own; so I put some small scripts together (into one script ultimately - each original piece did one thing only) to do what I needed, and I had KPPP execute the final script with an argument saying whether it was "dialing", "connected", or "disconnected" and the script reacted accordingly.

It's hard to write a script for the sake of writing a script - you do need a goal - and if that goal does something that helps you on your machine, it makes it interesting and satisfying to create your own solution.

Browse the programming forum for ideas - look at scripts (even just one-liners) that others have posted, and understand that they're doing. And when someone posts a question in the programming forum, looking for a solution, try to come up with one yourself: create the circumstances they describe (i.e. I have a log file that contains ABC, XYZ, and 123, and I need to....) and practice some ideas to do what they are looking for.

Keep in mind:
Absolute Bash Scripting guide;
TLDP's Bash intro (probably old, but worth a look): http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
Greg's Bash FAQ Wiki: http://mywiki.wooledge.org/BashFAQ

Good luck!
 
2 members found this post helpful.
Old 09-24-2010, 06:24 AM   #6
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Hi. If you like you can also try my shell script based projects. ^_^

PlayShell
Shell Script Loader

Last edited by konsolebox; 09-24-2010 at 06:25 AM.
 
1 members found this post helpful.
  


Reply



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
Anyone know good educational audio ? mbostwick Linux - General 3 05-06-2009 11:16 AM
bash shell projects vipin_jss Linux - Newbie 3 09-27-2007 06:39 PM
A useful Linux Educational site mickeyboa Fedora 2 08-04-2006 02:48 PM
Help with Educational Linux Sotware wcujoe Linux - Software 1 01-02-2006 05:49 PM
educational software alkat Linux - Software 0 05-01-2004 08:47 AM

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

All times are GMT -5. The time now is 09:38 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