From the computer of: seamonkey420
(130 recipes)
Created: Jul 24, 2005
Overview: This recipe is more of an appetizer to the meal. I will give a few example scripts and explain how each works and from there one can hopefully use the fundamental concepts in each and apply it to one's own area/field/use. However, there is more going on in each of my examples than just the script. One has to also be sure that the way they are setting up the data to be queried is going to work.. (ie lets say we have 100 customers who are identified in your system by a 5 digit customer number; be sure to keep the data structure for them consistent so when you go back to write a script to query data it makes life much easier!). Functions are not executed until called within the script, they just hang out until they are needed.. ;)
Creating a script that uses a function to call in a list of data.
script example:
how to use: copy the text in the quote below to a file named: script.ksh
then create list.txt file in the same folder with these numbers on a line:
1
2
3
then also create 3 text files with the same name as number in the the list, ie 1.txt, 2.txt, 3.txt and put some different data in each.
| Quote: |
|
# basic script that uses a function to call in a list of data to then query # function_test.ksh # creates function called readDATA function readDATA { echo $data'.txt' sleep 1 } #main script that will call function echo "Test Script: Read Data from List, test.txt" while read -r data do readDATA done < list.txt |
Subscribe to the Tech-Recipes Newsletter
You can get tips like this delivered in your email every week!
We will never, ever sell your email address or spam you.
Related recipes:
Creating a kornshell script with text-based menus in VI
Set an environment variable in Korn shell (ksh)
Checking if a variable is a number in ksh
Some Common AIX/Unix Commands
appending a list of files to one file using xargs command
Enable vi ksh command line editing
Sponsored links
Login
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.Search
Tech Recipes
· Home
· Mac OS X
· Solaris
· Windows
· Programming
· UNIX
· Cisco
· MySQL
· Google
· Instant messaging
· Add recipes
· Leave feedback
· Recommend us
· RSS Syndication
Hot recipes
Make XP look like Windows Vista / Longhorn for free!
XP: Small, Free Way to Use and Mount Images (ISO files) Without Burning Them
Hacks to Beat Rapidshare Download Limits and Waiting Time
How Do I Use or Open Bin, Cue, or ISO Files?
Vista: Should I Install 64-bit or 32-bit Version? (x64 vs x86)
XP: kill a Windows process from the command line with taskkill
MySpace: Hack to Download Any Song on MySpace
How to patch up your UXtheme.dll file in XP home or pro
Who's Online
There are currently, 2395 guest(s) and 1 member(s) that are online.
You are Anonymous user. You can register for free by clicking here
Information
Wish to advertise with us?
All logos and trademarks in this site are property of their respective owner. The comments and forum posts are property of their posters, all the rest © 2003-2007 by QD Ideas, LLC.
Users of this site are legally bound by the Terms and conditions and Disclaimer. Do not use this web site if you do not agree with these policies.
The members, admins, and authors of this website respect your privacy.
Page Generation: 0.98 Seconds
Fri Jul 4 6:07:18 2008