All pastes #15540 Raw Edit

chopseuy

public shellscript v1 · immutable
#15540 ·published 2005-06-22 11:28 UTC
rendered paste body
#!/bin/bash #function name "readfile"readfile (){#function begins here #declare variablesDIR=/home/jeipi/bin/routeractivity/ra-logs/             #directory where logfiles are kept                                                #if you want to specify the full path make sure                                                #that you begin with "/"                                                #also must always end in "/"LIMIT=3 #loop limit or number of tty to compare #loop begins herefor ((a=1; a <= LIMIT ; a++))   # Double parentheses, and "LIMIT" with no "$". do eval TTY$a=`cat $DIR* | grep "$a tty $a" |wc -l`eval echo "\$$TTY$a"# doneTtotal=$((TTY1+TTY2+TTY3))echo $Ttotal #function ends here} #close bracket for function close #check the logfiles first before running the scriptif [ -a "$DIR/" ]thenreadfileelseecho "directory does not exist"fi