LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-31-2015, 01:07 AM   #1
arivarasan.e@gmail.com
LQ Newbie
 
Registered: Dec 2015
Posts: 4

Rep: Reputation: Disabled
Problem with expr


Hi All,
I want to subtract two variables in shellscript. This is what I did:
echo "`expr ${var1} - ${var2}`"
But it throws error saying:
expr: syntax error

Anyone pls tell me the correct syntax for expr.
 
Old 12-31-2015, 01:12 AM   #2
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: Oregon, USA
Distribution: Lubuntu 14.04, Windows Vista
Posts: 5,166
Blog Entries: 3

Rep: Reputation: 691Reputation: 691Reputation: 691Reputation: 691Reputation: 691Reputation: 691
Hi...

Welcome to the forum

Just as a suggestion, you might want to contact Jeremy to change your username. Using your e-mail address will most likely result in your inbox being filled with SPAM very soon.

Regards...
 
Old 12-31-2015, 05:38 AM   #3
arivarasan.e@gmail.com
LQ Newbie
 
Registered: Dec 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Need to change the userid

Hi,
I'm not able to find any option to change the user id in Edit Profile link.. Can u help me pls
 
Old 12-31-2015, 04:00 PM   #4
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: Oregon, USA
Distribution: Lubuntu 14.04, Windows Vista
Posts: 5,166
Blog Entries: 3

Rep: Reputation: 691Reputation: 691Reputation: 691Reputation: 691Reputation: 691Reputation: 691
Quote:
Originally Posted by arivarasan.e@gmail.com View Post
Hi,
I'm not able to find any option to change the user id in Edit Profile link.. Can u help me pls
Hi...

There is none. As I mentioned, you will need to contact Jeremy, the forum's owner, to have this changed.

Regards...
 
Old 12-31-2015, 06:41 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,933

Rep: Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692
Quote:
Originally Posted by arivarasan.e@gmail.com View Post
Hi All,
I want to subtract two variables in shellscript. This is what I did:
echo "`expr ${var1} - ${var2}`"
But it throws error saying:
expr: syntax error

Anyone pls tell me the correct syntax for expr.
First, read the LQ Rules about text-speak, and about not using it. Spell out your words.

Secondly, there are THOUSANDS of easily-found bash scripting guides that cover this...read the "Question Guidelines" link in my posting signature, and do basic research first, before posting a question. Since you know it's a syntax error, that means that you also know what to look up. An example:
Code:
RESULT=`expr $var1 - $var2`
...from one of the 117,000 hits for "bash script to subtract two variables". Note those are back-ticks, not single-quotes.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with expr arivarasan.e@gmail.com Linux - Newbie 2 12-31-2015 10:47 AM
[SOLVED] test expr VS [ expr ] ashok.g Programming 3 12-04-2009 12:15 AM
How to multiply with expr? ( expr 3 * 4 doesn't work, though expr 3 + 4 does) lumix Linux - General 5 02-25-2009 06:31 PM
problem with expr function jadeddog Programming 10 06-29-2008 09:44 PM
About how to use expr naihe2010 Programming 2 10-31-2005 07:28 AM


All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration