User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,423 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,615 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 1122 | Replies: 2
Reply
Join Date: Apr 2007
Posts: 5
Reputation: milonix is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
milonix milonix is offline Offline
Newbie Poster

learning shell scripting

  #1  
Apr 20th, 2007
i wrote this script, and everytime i run the script the code deletes and i want to know why

EDIT: i also chmod 755 if anyone wanted to know

$ cat > ispostive
#!bin/sh
#
# Script to see whether argument is postive
#
if test $1 -gt 0
then
echo "$1 number is postive"
fi

just so everyone knows i just started to learn shell scripting
Last edited by milonix : Apr 21st, 2007 at 12:00 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: Bellevue, WA
Posts: 1,548
Reputation: Infarction has a spectacular aura about Infarction has a spectacular aura about Infarction has a spectacular aura about 
Rep Power: 8
Solved Threads: 51
Sponsor
Infarction's Avatar
Infarction Infarction is offline Offline
Battle Programmer

Re: learning shell scripting

  #2  
Apr 22nd, 2007
That's an interesting use of cat. Anyways, I tried running it, and it worked fine after a small change (you didn't put a / before bin/sh, so working from anywhere other than the / directory would not work).

output:
jimmy@vera ~/code/bash $ ./ispositive 4
4 number is postive
jimmy@vera ~/code/bash $ ./ispositive -4
jimmy@vera ~/code/bash $ ./ispositive 1234567890
1234567890 number is postive
jimmy@vera ~/code/bash $ ./ispositive 0
Reply With Quote  
Join Date: Apr 2007
Posts: 5
Reputation: milonix is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
milonix milonix is offline Offline
Newbie Poster

Re: learning shell scripting

  #3  
Apr 23rd, 2007
thanks
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 1:07 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC