Sponsored Content
Top Forums Shell Programming and Scripting Loop to read parameters and stop Post 302654795 by methyl on Tuesday 12th of June 2012 09:22:59 AM
Old 06-12-2012
Variation which allows for space characters in parameters, and illustrates walking the list with shift:

Code:
total=$#
counter=0
while [ $counter -lt $total ]
do
        echo "parameter = $1"
        shift
        counter=`expr $counter + 1`
done

 

10 More Discussions You Might Find Interesting

1. Programming

how to stop execution in for loop

Hi all, I am working on a c source code nearly 2000 line . it contains one big for( i=0; i< 200 ; i++ ) loop of around 600 lines could any tell me how to break the execution of prog when the value of i is 50 in for loop so that i can check inside the loop. Thanks.. (1 Reply)
Discussion started by: useless79
1 Replies

2. Shell Programming and Scripting

Script does not stop when doing a read

Hi Folks, I have been trying to create a script wherein after it reads a certain number of data, it will pause and ask the user if he wants to continue or not. However, it seems that when it is supposed to read the user's answer, the script will go into a loop. What is wrong with my script here?... (7 Replies)
Discussion started by: rooseter
7 Replies

3. Shell Programming and Scripting

Parameters in loop

Hi, I am trying to write a script which will read inputs form user and process those files, I have issue reading the input parameters in a loop. Following is the script... I run the script as ./Script.sh 3 table1 table 2 table3 NumberOfTables=$1 let TableCount=1 while do ... (3 Replies)
Discussion started by: mgirinath
3 Replies

4. Shell Programming and Scripting

read parameters from file

Hi there, I'm wondering how I can run a script that would loop and launch a command that would take as parameter every line in a file one by one. For example, say I want to remove a list of files: ~$ cat filestoremove foo bar ~$ cat myscript for file in filestoremove; do rm $file... (2 Replies)
Discussion started by: chebarbudo
2 Replies

5. Shell Programming and Scripting

Read parameters from a file

Hello all, I need to extract parameters from a file. For example, I have a file file.dat as par1 val1 par2 val2 par3 val3 I need to extract this and store val1 in par1 variable and so on. Please help. Thanks for your support. (2 Replies)
Discussion started by: cheerful
2 Replies

6. Shell Programming and Scripting

Null Handling in Until loop. . .loop won't stop

Hi Im running this script, which is supposed to find the max value build some tables and then stop running once all the tables are built. Thing is , it keeps assigning a null value to $h and then $g is null so it keep building tables i.e. testupdateNUL. How can I stop this? Here is what I have: ... (4 Replies)
Discussion started by: brandono66
4 Replies

7. Shell Programming and Scripting

howto stop loop iteration

I wonder how to stop further loop iterations when conditions gets false e.g. This file.txt contains the following structure : 1 2 3 4 5 6 7 8 9 10 How to stop iteration when if statement gets false ? for n in `cat file.txt` do if (( n<=5 )) (1 Reply)
Discussion started by: presul
1 Replies

8. Shell Programming and Scripting

How to stop infinite loop

Im unable to stop the below infinite loop (bash script). Can someone tell me why this isnt responding to signals eg: ctrl+c (SIGINT) or ctrl+z c=0 test_loop() { c=$(($c+1)) echo "count value is : $c " sleep 1 test_loop } Im using: SunOS 5.10 PS: If run this as... (13 Replies)
Discussion started by: Arun_Linux
13 Replies

9. Shell Programming and Scripting

Read command stop on either EOF or a specific line

I'm trying to stop reading a file until the end of the file is reached or a defined delimiter line is reached. Some how I need to test the fail state of the last 2 commands, not just the last command. echo -e "hello\ngoodbye\n####\ntesting" | while read line; ]; do echo "$line"; done hello... (4 Replies)
Discussion started by: Michael Stora
4 Replies

10. Programming

Read in numbers from console won't stop at newline.

Hello, I have snippet code from Lippman's <<C++ primer>>. The program is to convert regular decimal (0 ~ 15) numbers to basic hexdecimals. The instruction tells the program will execute by hitting newline at the end. When I tried to run the compiled program, hitting ENTER did not work as... (3 Replies)
Discussion started by: yifangt
3 Replies
rlm_counter(5)							 FreeRADIUS Module						    rlm_counter(5)

NAME
rlm_counter - FreeRADIUS Module DESCRIPTION
The rlm_counter module provides a general framework to allow access based on accumulated usage of a resource, such as total time online in a given period, total data transferred in a given period, etc. This is very useful in a 'Prepaid Service' situation, where a user has paid for a finite amount of usage and should not be allowed to use more than that service. Collection, monitoring, and replenishment of prepaid services are beyond the scope of this module. The main configuration items to be aware of are: filename The filename where the usage data is stored. key An attribute which will be present in the Access-Request to be used as the 'index' value for the counter. A counter entry is tracked for each unique key. The most likely key you will want to use is User-Name. count_attribute An attribute which will be used to increment the counter value. If this attribute is Acct-Session-Time or an integer value the counter data is incremented by the Attribute value. For all other attribute types the counter is incremented by one. reset How frequently the counter data should be set back to 0. Valid values for this variable are: hourly, daily, weekly, monthly, orn- ever Alternatively, it can be user defined, in the form: num[hdwm]. num is a numeric value, followed by one or none of the follow- ing letters. h: hours, d: days, w: weeks, m: months. check_name This defines an attribute name which will be registered by the counter module and can be used to set the maximum allowed value for the counter after which the user is rejected. If Daily-Session-Time is set, you can use the following syntax in the Users file to set a cap of 3600 seconds ( 8 hours ): DEFAULT Max-Daily-Session := 3600 reply_name This is the name of the attribute which will contain the remaining value for the counter in the reply packet when the user is suc- cessfully authorized. The default attribute name is "Session-Timeout". allowed_service_type This can be used to only apply the limitations to specific service types of sessions. For example, setting this to Framed-User will only apply the counter module to Framed sessions, excluding other types such as Telnet or Rlogin. cache_size The maximum size of the cache to be used by the module. The default is 1000. NOTES
This module registers an attribute, so it should be added to the instantiate section, to be called on server startup. When used in the authorize section, it must come after any modules which set the 'check_name' attribute. SECTIONS
instantiate, authorize, accounting FILES
/etc/raddb/radiusd.conf SEE ALSO
radiusd(8), radiusd.conf(5) rlm_sqlcounter(5) AUTHOR
Chris Parker, cparker@segv.org 13 March 2004 rlm_counter(5)
All times are GMT -4. The time now is 03:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy