Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 05-20-2009, 02:58 PM   #1 (permalink)
Osiris's Avatar
 

Join Date: Jan 2005

Location: Kentucky

Posts: 32,076

Osiris is a jewel in the roughOsiris is a jewel in the roughOsiris is a jewel in the rough

Send a message via ICQ to Osiris Send a message via AIM to Osiris Send a message via MSN to Osiris Send a message via Yahoo to Osiris Send a message via Skype™ to Osiris
Default Get to know Linux: Bash scripting basics

Source Get to know Linux: Bash scripting basics

After using Linux for a while you will eventually find yourself needing to create a bash script. And just what is a bash script? A bash script is a script that is run through the bash shell. Usually a bash script is a user-generated script that serves a specific purpose and combines numerous commands into one convenient script.
I am a big fan of bash scripting. I use them frequently to create backup scripts, scripts that are used via cron, and much more. But before I could write even a simple bash script, I had to understand the basics. And that’s what you will learn here - the very basics of bash scripting. This will be a foundation you can build upon so that your bash scripts can get more and more complex.
__________________
Osiris is online now  
Old 05-22-2009, 12:28 PM   #2 (permalink)
 
Monster Techie

Join Date: Sep 2005

Location: /home/jason

Posts: 1,823

Jayce will become famous soon enoughJayce will become famous soon enough

Send a message via AIM to Jayce
Default Re: Get to know Linux: Bash scripting basics

Just to share personal experience: I have a spare hard drive in my computer of ample size compared to my primary. I created a script as follows:

#!/bin/bash
rsync -a --progress --delete /home/jason/ /media/storage/localbackup/

I named it "backup" and ran sudo chmod +x /usr/local/bin/backup (where the file is stored).

That command made it executable.

Then I edited crontab to run "backup" as user "jason" (who also owns the file) @ 4 AM and 4 PM.

So when my hard drive dies, like my lovely brand new Seagate did last month, data-wise : I'm covered.
Jayce is offline  
Old 06-25-2009, 09:54 PM   #3 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: Get to know Linux: Bash scripting basics

i was looking up some shell scripting tips and found this. it has a bunch of tips and tricks with practicle uses.

How to write a shell script - Linux Research Project
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fundamental Differences Between Linux and Windows Osiris Linux Tips and Tricks 0 12-11-2008 06:13 PM
Useful list of Linux websites. tribalsun Linux, BSD, other *nixes & Open Source Software 33 11-30-2008 12:35 AM
The five best things in Linux 2.6.27 Osiris Linux Tips and Tricks 2 10-21-2008 09:13 PM
New with Linux MindHacked Linux, BSD, other *nixes & Open Source Software 8 04-16-2008 09:18 PM
Want to make the move to Linux for good...advice? BoysNightOut Linux, BSD, other *nixes & Open Source Software 25 05-16-2007 11:40 AM