LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-31-2009, 08:08 AM   #1
icecubeflower
Member
 
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 304

Rep: Reputation: 33
more shell questions


Hey I tried a tutorial's example and I can't make it work

Q.5.Modify above and store division of x and y to variable called z
For Ans. Click here
$ x=20
$ y=5
$ z=`expr x / y`
$ echo $z

Oh wait, I made it work. That's not a single quote, that's that crazy backquote character by the 1 key.

Okay but I still have to do this:
$ z=`expr $x / $y`

His example doesn't use the $ signs. Why?
 
Old 03-31-2009, 08:20 AM   #2
hifun
LQ Newbie
 
Registered: Dec 2008
Distribution: Fedora 8
Posts: 28

Rep: Reputation: 15
$x means value inside the variable x.If $ not used, then echo will treat it as x only and flash an error
non-numeric constant
 
Old 03-31-2009, 08:22 AM   #3
maxy7710
Member
 
Registered: Jan 2008
Location: Mumbai, india
Distribution: REDHAT, FEDORA,SUSE, UBUNTU, ORACLE ENTERPRISE LINUX & SOLARIS 10
Posts: 130

Rep: Reputation: 17
its printed wrong in the tutorial, cos without the $ we would never get the values.
 
Old 03-31-2009, 08:23 AM   #4
maxy7710
Member
 
Registered: Jan 2008
Location: Mumbai, india
Distribution: REDHAT, FEDORA,SUSE, UBUNTU, ORACLE ENTERPRISE LINUX & SOLARIS 10
Posts: 130

Rep: Reputation: 17
its printed wrong in the tutorial, cos without $ we would never get the value for x.
 
  


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
shell questions cnhawk386 Linux - Software 3 09-20-2007 11:45 AM
some shell questions cnhawk386 Linux - Software 4 09-20-2007 04:40 AM
Shell Scripting Questions blaoulis Programming 5 07-12-2006 08:21 PM
Shell Script Questions Col Panic Linux - General 13 10-12-2003 01:51 PM
Shell Questions BajaNick Linux - General 7 08-06-2003 05:15 AM

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

All times are GMT -5. The time now is 11:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration