Sponsored Content
Top Forums Shell Programming and Scripting Problem in algebraic substraction Post 302630227 by 47shailesh on Wednesday 25th of April 2012 02:00:05 PM
Old 04-25-2012
One error is due to value with leading space entered by user. Also I made few correction in your script.
Code:
echo -n "ENTER VALUE BETWEEN 01-31 "
read value
count=`tail -1 filecount.txt | tr -d " "`  ###file is having value 264  ####
echo "actual count = $count"
exact_count=`expr $value \* 24`
echo "exact_count= $exact_count"
diff=`expr "$exact_count" - "$count"`
a=`expr "$exact_count" - "$count"`
echo " value is $a"
echo "$diff"

This User Gave Thanks to 47shailesh For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Date Substraction

In Unix script, how to get a "date - 1" ie, yesterday? (4 Replies)
Discussion started by: AC
4 Replies

2. Solaris

Substraction in bash

Hi all, I have in one script something like this: FIRSTOCC=`grep -n ORA- alert_bill2.log |tail -"$ROWS"|head -1|cut -d: -f1` TOTAL=`more alert*|wc -l` DIFFERENCE=`$TOTAL-$FIRSTOCC` echo Total lines in alert_bill = $TOTAL echo $DIFFERENCE How do I make this substraction work? Thk (2 Replies)
Discussion started by: mclaudiu
2 Replies

3. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

4. Shell Programming and Scripting

date substraction

hello i have obtained the current date .. current_date=date "+%m/%d%y" and i have another date ,stored in my log file which i have already retrieved. i want to store the subtraction in a varible called diff. diff=log_date - currentdate ex: log_date=01/28/11 current_date=... (3 Replies)
Discussion started by: urfrnddpk
3 Replies

5. Shell Programming and Scripting

problem in algebraic expression

count=`cat /filecount.txt | tail -1 |head -1| awk '{print $1}'` exact_count=`expr $value \* 24` i want to subtract a="$exact_count" - "$count" but its not taking o/p of "count" as number $a is wrong answer hence not getting proper output. plz help me out :confused: Please use... (3 Replies)
Discussion started by: sagar_1986
3 Replies

6. Shell Programming and Scripting

Try solver System of linear algebraic equations in Shell Bash

I want to try solving system of linear algebraic equations in Shell bash but i have any problems Value input is matrix and I dont know how to input matrix in Shell because that is dont support 2-dimensional array Please help me. Thank you so much (3 Replies)
Discussion started by: newbieseos
3 Replies

7. Shell Programming and Scripting

Substraction in shell scripting

Hello friends, I am new on linux, i am facing issues on below script. #!/bin/sh current=1355147377 echo $current last_modified=1354537347 echo $last_modified DIFF='expr ($current - $last_modified)' echo $DIFF Please view this code tag video for how to use code tags when posting... (8 Replies)
Discussion started by: sanjay833i
8 Replies

8. Shell Programming and Scripting

awk - sed / reading from a data file and doing algebraic operations

Hi everyone, I am trying to write a bash script which reads a data file and does some algebraic operations. here is the structure of data.xml file that I have; 1 <data> 2 . 3 . 4 . 5 </data> 6 <data> 7 . 8 . 9 . 10</data> etc. Each data block contains same number of lines (say... (4 Replies)
Discussion started by: hayreter
4 Replies

9. Shell Programming and Scripting

Substraction of matching lines from a file.

I have 2 files: file1.txt contains /html/mybook/Charts/143712/reptiles.pdf /html/mybook/Charts/198459/spices.pdf /html/mybook/Charts/198459/fresh_nuts.pdf /html/mybook/Charts/123457/dome_anim.pdf /html/mybook/Charts/123457/vegetables.pdf /html/content/3DInteractive/174091/CSPSGGB.html ... (6 Replies)
Discussion started by: Jojan Paul
6 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 09:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy