Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 15th, 2006, 12:38 AM   #1
Phonetic
Newbie
 
Join Date: Nov 2006
Posts: 5
Rep Power: 0 Phonetic is on a distinguished road
Simple question, I think?

I'm relatively new to scripting so please take it easy on me. Right now I'm working on two different scripts, using the bash shell in linux. The first one keeps giving me a "command not found error. Here's the script.

sales=$1
costs=$2

echo $1
echo $2
net=[[ $sales-$costs ]]
echo "The networth is $net"

The second one is:

read -p "What is your name? " name
read -p "How old are you? " age

if [[ $name==tyler ]]
then
if [[ $age==19 ]]
then
clear
echo "calcuating"
sleep 1
clear
echo "calcuating."
sleep 1
clear
echo "calcuating.."
sleep 1
clear
echo "calcuating..."
sleep 1
clear
echo "calcuating...."
sleep 1
clear
echo "calcuating....."
sleep 1
clear
echo "You should see a doctor about that."
sleep 3
clear
echo "End!"
sleep 3
clear
else
clear
echo "calcuating"
sleep 1
clear
echo "calcuating."
sleep 1
clear
echo "calcuating.."
sleep 1
clear
echo "calcuating..."
sleep 1
clear
echo "calcuating...."
sleep 1
clear
echo "calcuating....."
sleep 1
clear
echo "I'd say you're relatively normal."
sleep 3
clear
echo "End!"
sleep 3
clear
fi
fi

I'm sorry for the long post, thanks in advance for any help.
Phonetic is offline   Reply With Quote
Old Nov 15th, 2006, 1:11 AM   #2
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 319
Rep Power: 4 andro is on a distinguished road
Send a message via AIM to andro
#!/bin/bash
sales=$1
costs=$2

echo $1
echo $2
net=$(($sales-$costs))
echo "The networth is $net"
andro is offline   Reply With Quote
Old Nov 15th, 2006, 2:45 AM   #3
Phonetic
Newbie
 
Join Date: Nov 2006
Posts: 5
Rep Power: 0 Phonetic is on a distinguished road
thank you very much!

I just don't understand, why did I need that $ in front of the parenthesis?
Phonetic is offline   Reply With Quote
Old Nov 15th, 2006, 4:31 AM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Phonetic View Post
I just don't understand, why did I need that $ in front of the parenthesis?
That's just how it was built. It's a shorthand syntax for evaluating an expression: $((<expression>))
Arevos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
very simple question. make button change number in edit box nickm Delphi 2 Apr 29th, 2006 11:47 PM
A simple programming question punter C# 8 Jan 5th, 2006 5:04 PM
A simple question Master C++ 9 Dec 24th, 2005 3:20 PM
Simple (stupid cause I don't know it) basic question massive-war C++ 17 Apr 12th, 2005 12:03 AM
Simple Writing to Files. Newbie Question kiaran C++ 1 Feb 8th, 2005 4:22 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:44 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC