LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 12: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, 12:12 AM   #2
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
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, 04: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, 03:00 PM   #4
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
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, 05:41 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
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



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 09:47 AM
[SOLVED] test expr VS [ expr ] ashok.g Programming 3 12-03-2009 11:15 PM
How to multiply with expr? ( expr 3 * 4 doesn't work, though expr 3 + 4 does) lumix Linux - General 5 02-25-2009 05:31 PM
problem with expr function jadeddog Programming 10 06-29-2008 08:44 PM
About how to use expr naihe2010 Programming 2 10-31-2005 06:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:32 AM.

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
Open Source Consulting | Domain Registration