LinuxQuestions.org
Help answer threads with 0 replies.
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 10-25-2007, 01:58 PM   #1
Mohtek
Member
 
Registered: Dec 2004
Location: Colorado
Distribution: Kubuntu/Debian/Centos
Posts: 126

Rep: Reputation: 15
Can you help me create a list of shell scripts to make :)


Hello everyone,

I'm getting my feet wet again and now I am determined to learn Bash (and thats the beginning. I'm so new to everything still that I am not sure of the possibilities.

I know the motto, to learn a programming language, two things are needed: write code and read code.


I want to learn how to write code. Could anyone give a me a list of tasks to automate that would require me to write shell scripts? Let your imagination run wild, the more tasks of varied difficulty, the better I will get and the more I will learn.


so...Is anyone up to (giving me) the challenge?


Thank you all
Mohtech
 
Old 10-25-2007, 03:29 PM   #2
ehawk
Senior Member
 
Registered: Jul 2003
Posts: 1,257

Rep: Reputation: 48
http://www.google.com/search?hl=en&q...=Google+Search
 
Old 10-25-2007, 04:03 PM   #3
rsashok
Member
 
Registered: Nov 2006
Location: USA, CA
Distribution: RedHat, Debian
Posts: 202

Rep: Reputation: 31
Write a script that take a word as a parameter, checks it to be only ASCII characters. Find this word in the input stream or file, capitalizes all letters in this word and write it to the output file.

Last edited by rsashok; 10-25-2007 at 07:01 PM.
 
Old 10-25-2007, 04:06 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
You would be far better off defining something you want the computer to do, and use that as your learning tool.

I learned BASH because I wanted to gather data from a large LDAP directory and track some statistics over time. At the same time, I wrote a small script which just looks up phone numbers--crude, buggy, but faster than the official company web-based method.

The next project I have been noodling is batch-conversion of image files using the ImageMagick tool set. (eg down-sampling for e-mail)
 
Old 10-26-2007, 01:02 AM   #5
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
You can write a post installation script, which could run all post-installation things you do after installing. It could save you lots of time if you're installing to different computers.
 
Old 10-26-2007, 01:29 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Read the info manual for the coreutils package. It contains a large number of base utilities such as ls and move, but also a large number number of text handling utilities such as cut, comm, sort, uniq.

Bash programs will assemble a series of these small dedicated utilities; piping the output of one to the input of another. If your programs use the read command, you are probably doing it wrong!

At work, I needed a way of producing a catalog of video files I backed up to DVD. I came up with a simple script that extracted the information from ls -l that I needed, used enscript to produce the catalog, and then used ps2pdf to create a file that I would save on the server. The other employees only need to double click on the file to open the file in acroread, and use [ctrl]-f to search for the particular file in the catalog. I installed cygwin on my work computer because the *nix utilities are so useful. I can't imagine how I would do this in windows. The backup program only produces an opaque file that you can only use with with the same program.

Be sure you look at the Advanced Bash Scripting Guide on the www.tldp.org website. It is a book composed of commented examples. Type in the examples your self as practice and for learning by doing.

Also, understand passing arguments to scripts and functions in a script. Using the getopts and case commands will allow you to write scripts that process arguments like regular commands do. Actually some commands that you use might be bash scripts themselves. One example in SuSE is the mkinitrd command. In Mandrake, it was a perl script.

Last edited by jschiwal; 10-26-2007 at 01:37 AM.
 
Old 10-26-2007, 02:17 AM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I recently neeed to hone my skills in certain aspects of shell scripting and started writing implementations of several utilities from util-linux and coreutils in pure BASH. I got about 14 of them done, icluding cut, tail, wc, rev sort and others. It proved to be a good way to motivate my efforts, particularly because I had a list of programs that I needed to run in a shell-only environment.
 
Old 10-26-2007, 04:29 AM   #8
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
how about a script that makes a cup of tea in the morning?
 
  


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
How do I create an rpm containing our own scripts and tools? gerben12 Linux - Server 3 10-20-2007 01:10 PM
how to make a filename make list and feed it to the tar utility nass Slackware 9 09-25-2007 11:51 AM
Shell scripts shmuel_orgad Programming 4 05-21-2006 05:33 AM
shell scripts... roofy Linux - Newbie 13 05-06-2003 06:06 PM
Command to list line length of multiple scripts Tekime Linux - General 2 09-06-2002 01:04 AM

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

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