Sponsored Content
Full Discussion: Counter function problems...
Top Forums Shell Programming and Scripting Counter function problems... Post 302170819 by LinuxRacr on Tuesday 26th of February 2008 08:58:32 PM
Old 02-26-2008
I fixed it by combining two functions into one:

Code:
function adder_func
         {
         TYPE=$1
         if [ -s sizes.$TYPE ]; then
            let sum=0
            for i in `cat sizes.$TYPE`
            do
             ((i=$i-5104))
             ((new_sum=$i + $sum))
             sum=$new_sum
            done
            ((meg_sum=$new_sum/1024))
            ((gig_sum=$meg_sum/1024))
            ((last_sum=$gig_sum*$NUMBER))
            echo ${last_sum}G
           else
            break
          fi
         }

## Call the adder_func function and output to value.txt to get the max size for your lvol.
adder_func size > value.txt

Now everything will be GigaByte readable, instead of in KBytes.

And now the output of value.txt:
2495G

And the effect:

Are you ready to create a lvol in fakedg?
Enter 'y' for Yes or 'n' for No :y

Enter the name of your lvol.

Lvol name :fakelvol

Enter the size of your lvol.
The maximum size is: 2495G

Lvol size :
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

counter in a variable - can it be done?

I have the following for(( i=1; 1<=2; i++)) do e1=123 n1=123 e2=456 n2=456 coord= $e1,$n1 echo "coordinate=$coord" done exit this echos coordinate=123,123 I need it to loop so: loop1 coord=$e1,$n1 loop2 (3 Replies)
Discussion started by: gazz1982
3 Replies

2. Shell Programming and Scripting

Counter Script..help please

I have generated a script that will email a list of people if a certain PID is not running, using "mailx". I have the script running every 5 minutes as a cron job. I want the script to stop sending an email, if the email has been sent 5 times (meaning PID is dead). I want this so that my... (3 Replies)
Discussion started by: Sunguy222
3 Replies

3. Programming

Please help! accept function problems in Socket programming

Hi, I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused: After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
Discussion started by: natxie
1 Replies

4. Shell Programming and Scripting

counter

Hi, I need some help. Shell script counter. i need to add condition to check if counter is more than 10 and longer than 3 hours? it runs every 5 mins. it only check count and send email right now. it runs in cron as below gregcount.ksh gregdb 10 > /tmp/gregcount.out 2> /tmp/gregcount.err ... (1 Reply)
Discussion started by: pega
1 Replies

5. Shell Programming and Scripting

DelimiterCount: how to use a counter

Hi, I am new to shell script. I want to count to Delimiter count for my source file. For that I have written script. When I tried to execute the script I could not able to view the results. It throws errors. I don't know what the problem is. My aim is I want to store the delimiter count in one... (4 Replies)
Discussion started by: suresh01_apk
4 Replies

6. Shell Programming and Scripting

"help me!!" if and function problems

I am trying to allow the user to be notified that the id has already taken from the file "record" and that the user has to contain a numerical figure as well. however when i run it, it will only stay at the please enter a number section and does not change. do u know where is the problem? ... (2 Replies)
Discussion started by: bassmasta1
2 Replies

7. UNIX for Dummies Questions & Answers

Problems with "exit" called from function in bourne script

Hi everyone. #!/sbin/sh EXITING() { umount /FOLDER rm -Rf /FOLDER echo "EXIT" exit 0 } EXITING echo "OK" (8 Replies)
Discussion started by: vacadepollo
8 Replies

8. Programming

Problems with JNI and currentTimeMillis function

Hello, I have a technical problem: I work on AIX 7.1 with Java 1.7 (32 and 64 bit) and I make an application that intercepts certain functions related to time. In this application there is a Java JNI agent with whom I can intercept the Java "getLastModifiedTime" no problem but I am unable to... (5 Replies)
Discussion started by: steph311
5 Replies

9. Shell Programming and Scripting

Counter

if ;then echo "mrnet greater 5000" gzip /var/log/mrnet.log mv /var/log/mrnet.log.gz /var/log/mrnet.log.1.gz if ];then i=1 let i++ mv /var/log/mrnet.log.1.gz /var/log/vieux-logs/mrnet.log.$i.gz else echo "theres no... (1 Reply)
Discussion started by: Froob
1 Replies

10. UNIX for Dummies Questions & Answers

Pegging counter

Hi Experts, I am in need for some help. My competence level on unix is not at all helping me to resolve this. Please help. My Input for a system command is as under: Counters are getting pegged each hour. I need to have a difference printed rather than pegged counter values. Counter... (2 Replies)
Discussion started by: vanand420
2 Replies
MIXER(8)						    BSD System Manager's Manual 						  MIXER(8)

NAME
mixer -- set/display soundcard mixer values SYNOPSIS
mixer [-f device] [-s | -S] [dev [[+|-]lvol[:[+|-]rvol]]] ... mixer [-f device] [-s | -S] recsrc ... mixer [-f device] [-s | -S] {^|+|-|=}rec rdev ... DESCRIPTION
The mixer utility is used to set and display soundcard mixer device levels. It may also be used to start and stop recording from the sound- card. The list of mixer devices that may be modified are: vol, bass, treble, synth, pcm, speaker, line, mic, cd, mix, pcm2, rec, igain, ogain, line1, line2, line3, dig1, dig2, dig3, phin, phout, video, radio, and monitor. Not all mixer devices are available. Without any arguments, mixer displays the current settings for all supported devices, followed by information about the current recording input devices. If the dev argument is specified, mixer displays only the value for that dev. To modify the mixer value dev, the optional left and right channel settings of lvol[:rvol] may be specified. The lvol and rvol arguments may be from 0 - 100. Omitting dev and including only the channel settings will change the main volume level. If the left or right channel settings are prefixed with + or -, the value following will be used as a relative adjustment, modifying the cur- rent settings by the amount specified. If the -s flag is used, the current mixer values will be displayed in a format suitable for use as the command-line arguments to a future invocation of mixer (as above). The -S flag provides the above output without mixing field separators. To change the recording device you use one of: ^rec toggles rdev of possible recording devices +rec adds rdev to possible recording devices -rec removes rdev from possible recording devices =rec sets the recording device to rdev The above commands work on an internal mask. After all the options have been parsed, it will set then read the mask from the sound card. This will let you see EXACTLY what the soundcard is using for the recording device(s). The option recsrc will display the current recording devices. The option -f device will open device as the mixer device. FILES
/dev/mixer the default mixer device SEE ALSO
cdcontrol(1), sound(4) HISTORY
The mixer utility first appeared in FreeBSD 2.0.5. AUTHORS
Original source by Craig Metz <cmetz@thor.tjhsst.edu> and Hannu Savolainen. Mostly rewritten by John-Mark Gurney <jmg@FreeBSD.org>. This manual page was written by Mike Pritchard <mpp@FreeBSD.org>. BSD
June 2, 2014 BSD
All times are GMT -4. The time now is 03:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy