All pastes #15533 Raw Edit

chopseuy

public shellscript v1 · immutable
#15533 ·published 2005-06-22 10:45 UTC
rendered paste body
#!/bin/bash #function name "readfile"readfile (){#function begins here #declare variablesDIR=/home/chopseuy/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 TTY$a=`cat $DIR* | grep "$a tty $a" |wc -l`echo "tty $a = $TTY" done #function ends here} #close bracket for function close #check the logfiles first before running the scriptif [ -a "$DIR/" ]thenreadfileelseecho "directory does not exist"fi