![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing global variable to a function which is called by another function | sars | Shell Programming and Scripting | 4 | 06-30-2008 12:39 PM |
| function help | coolkid | Shell Programming and Scripting | 2 | 05-01-2008 02:47 PM |
| Log function | Ernst | Shell Programming and Scripting | 17 | 03-19-2007 12:31 PM |
| Function within function (Recurance) | chassis | UNIX for Dummies Questions & Answers | 2 | 09-19-2006 10:32 AM |
| How to convert the "select" function into a "poll" function | rbolante | High Level Programming | 1 | 07-10-2001 11:49 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
The shell script below (test.cmd) gives me the error 'test.cmd: function: not found' However if I use it like function_name() { code } it works fine. Problem is that i am studying the system code and its using it like function function_name { code } Can anybody guide me on how to use function function_name { code } in shell scripts. Code:
#ParseRowcount()
function ParseRowcount
{
echo "entered ParseRowcount"
VALUES=$1
echo $VALUES
TOTAL=0
for V in $VALUES
do
TOTAL=`expr $TOTAL + 1 `
echo "entered loop"
done
}
#ParseLog()
function ParseLog
{
echo "entered ParseLog"
ROWS_LOADED=`grep "successfully" $1 | cut -d"R" -f1`
echo $ROWS_LOADED
ParseRowcount "$ROWS_LOADED"; ROWS_LOADED=$TOTAL
echo "Rows loaded................${ROWS_LOADED}"
}
ParseLog ./test1.txt
added code tags for readability --oombera Last edited by oombera; 02-18-2004 at 12:10 PM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|