Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Trying a arithmatic on a command line vs scripting. Post 302338236 by Franklin52 on Monday 27th of July 2009 10:33:17 AM
Old 07-27-2009
Try this:

Code:
A=20
B=50
C=$(( $A * $B ))
echo $C

Have a read of a scripting tutorial:

https://www.unix.com/answers-frequent...tutorials.html

Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

KSH arithmatic Integer overflow

Guys, I have two big numbers to multiply. In doing do I am getting integer overflow. I managed to multiply number but this number is useless as KSh does not recognise it as a valid number. Here is what I am doing $ expr 999999999999 \* 100 276447132 I got the right value by doing... (2 Replies)
Discussion started by: vikas_sri
2 Replies

2. Shell Programming and Scripting

End of Line in Shell Scripting

I have a file containing records seperated by delimiter '|'.A record is contained on 2 or 3 lines. Now I need a shell script which could write all records with in two '|' character in one line.....for example..... |R1........................R1 R1..........................R1... (2 Replies)
Discussion started by: 33junaid
2 Replies

3. Shell Programming and Scripting

Unix Arithmatic operation issue , datatype issue

Hi, I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ). Eg: 0000001 0000220 0001235 0000022 0000023 ........... ......... ........ Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies

4. Shell Programming and Scripting

arithmatic with awk

hi, i am trying some awk arthmatic calculation,i have a problem if any one can help let say if i have a file exm.txt 3 + 2 3 * 2 3 / 2 3 - 2 the output expected is awk -f exm.awk exm.txt 3 + 2 = 5 3 * 2 = 6 3 / 2 = 1.5 3 - 2 = 1 i simply used exm.awk { print $1 " + " $3 "= " $1 +... (3 Replies)
Discussion started by: phone_book
3 Replies

5. Shell Programming and Scripting

How to compare a command line parameter with -- in shell scripting

Hi, I need to check if a parameter provided at the command line is equal to --.How can i do that ? Please help me. Thanks and Regards, Padmini (4 Replies)
Discussion started by: padmisri
4 Replies

6. Shell Programming and Scripting

awk: round output or delimit output of arithmatic string

I have a file with the following content. > cat /tmp/internetusage.txt 6709.296322 30000 2/7/2010 0.00I am using the following awk command to calculate a percentage from field 1 and 2 from the file. awk '{ print $1/$2*100 }' /tmp/internetusage.txt This outputs the value "22.3643" as a... (1 Reply)
Discussion started by: jelloir
1 Replies

7. Shell Programming and Scripting

Need one line scripting on Unix shell..help!!

Hi Experts, I need one line script for the below requirement. First it should check if a directory with todays date exist, and if not create it and move the PDF file to that directory. thanks in advance!!! (2 Replies)
Discussion started by: eeegopikannan
2 Replies

8. Shell Programming and Scripting

arithmatic

Hi Guys, I am relatively new to scripting at the moment and am struggling to get the following function to work. For some reason it does not recognise the arithmatic symbol when i select option1. Any help would be greatly appreciated. menu () { echo "==============" echo "Calculator"... (4 Replies)
Discussion started by: somersetdan
4 Replies

9. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

10. Shell Programming and Scripting

Help with scripting-->Inserting a line before a pattern

Hi Guys, I have written the following script test.sh in Linux . read -p "Please enter the name of the application: " DIRTOCREATE read -p "Please enter the number of associates to be given access to svn:" COUNT for (( i=0 ; i<$COUNT ; i++ )) do read -p "Enter the associate id :"... (2 Replies)
Discussion started by: Pradeep_1990
2 Replies
psradm(8)						      System Manager's Manual							 psradm(8)

NAME
psradm, offline, online - Stops and starts processors in a multiprocessor system SYNOPSIS
/usr/sbin/psradm -f [-v] [[-a] [processor_id...]] /usr/sbin/psradm -n [-v] [[-a] [processor_id...]] /usr/sbin/online [-v] [processor_id...] /usr/sbin/offline [-v] [processor_id...] OPTIONS
The following options apply only to the psradm command: Specifies that all the processors except the master processor be put off line or on line. Puts the specified processor off line. Puts the specified processor on line. The following option applies to all forms of the command: Displays a message about the status of the operation performed on each processor. DESCRIPTION
On a multiprocessor system, the psradm command puts one or more processors off line (stops a processor) or on line (starts a processor). The processor_id variable specifies an integer that uniquely identifies a processor. Use the psrinfo command to display processor identi- fication numbers. The offline command puts one or more processors off line (stops a processor). If no processors are specified, all processors that are on line are stopped except the master processor. The online command puts one or more processors on line (starts a processor). If no processors are specified, all processors that are off line are started. Note that you cannot use these commands to start or stop the master processor in a multiprocessor system. You must be the root user to use this command. The /var/adm/wtmp file contains information about successful processor state transitions. RESTRICTION
Do not use the psradm command to disable CPUs when benchmarking performance, because the command does not provide an accurate reflection of the performance of a system that actually has fewer CPUs. Accurate performance results are obtained only when you disable the CPUs at the SRM console command level. EXAMPLES
The following command puts processors 2 and 3 off line: # psradm -f 2 3 The following command puts all the processors on line: # psradm -n -a The following command puts all processors on line: # online -v FILES
SEE ALSO
Commands: pset_info(1), psrinfo(1) Files: processor_sets(4) psradm(8)
All times are GMT -4. The time now is 01:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy