![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 12:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 12:06 AM |
| here document to automate perl script that call script | hogger84 | Shell Programming and Scripting | 3 | 10-22-2007 07:15 AM |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 04:05 AM |
| return valuse from child script to parent script | borncrazy | Shell Programming and Scripting | 1 | 08-20-2004 12:39 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
help with script...
hi, i am in college and taking a unix class. i have a project due next week and just wanted some help with it. i figured thsi would be a good place to ask. so here goes...
i'm going to post my pseudocode right now, and ill put up my codes right after...so Code:
#! /usr/bin/sh
#---------------------------------------#
# #
# Project 1 #
# #
# Lists all files from the #
# current directory that #
# match a specified pattern & #
# are newer, older, or the same #
# as a given date #
# #
#---------------------------------------#
#---------------------------------------#
# #
# Get the search pattern #
# #
#---------------------------------------#
#---------------------------------------#
# #
# Get the date in the form mm dd yyyy #
# #
#---------------------------------------#
#---------------------------------------#
# #
# Get the flag 1 = newer than #
# 2 = older than #
# 3 = same as #
# #
#---------------------------------------#
#---------------------------------------#
# #
# Send the pattern output to a file #
# #
#---------------------------------------#
ls -ld etc ...
#---------------------------------------#
# #
# Write a marker at the end of file #
# #
#---------------------------------------#
THIS PART IS OPTIONAL, AS SHOWN BY EXAMPLES IN CLASS
#---------------------------------------#
# #
# Remaining input comes from the file #
# #
#---------------------------------------#
#---------------------------------------#
# #
# Display proper heading #
# #
#---------------------------------------#
#---------------------------------------#
# #
# Loop to process file lines #
# #
#---------------------------------------#
read 9 things
while [ ]
do
#---------------------------------------#
# #
# Determine time (1) or year (2) #
# #
#---------------------------------------#
case
Need to test for colon
esac
#---------------------------------------#
# #
# Translate character month to integer #
# #
#---------------------------------------#
12-part if
#---------------------------------------#
# #
# Compute correct year #
# #
#---------------------------------------#
if [ no colon in YearOrTime ]
then
Year=$YearOrTime
else
CurrentYear=`date '+%Y'`
CurrentMonth=`date '+%m'`
if [ $CurrentMonth between 1 and 6 ]
then
if [ $Month between 7 and 12 ]
then
Year=$CurrentYear
Year=`expr $Year - 1`
else
Year=$CurrentYear
fi
else
Year=$CurrentYear
fi
fi
#---------------------------------------#
# #
# Identify files newer (1) or older (2) #
# for processing #
# #
#---------------------------------------#
if [ looking for newer than ]
then
elif [ looking for older than ]
then
else (this is the 'same as' part)
fi
read 9 new things
#---------------------------------------#
# #
# Existence test #
# #
#---------------------------------------#
THIS PART IS OPTIONAL, AS SHOWN BY EXAMPLES IN CLASS
done
#---------------------------------------#
# #
# Remove the output file #
# #
#---------------------------------------#
|
| Forum Sponsor | ||
|
|