The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
what is $$ S$ $# in shell scripting PrasannaKS Shell Programming and Scripting 2 01-14-2009 10:47 PM
Shell scripting - FTP ddk2oo5 Shell Programming and Scripting 1 01-05-2009 05:11 PM
difference between AIX shell scripting and Unix shell scripting. haroonec Shell Programming and Scripting 2 04-12-2006 08:12 AM
Help on SED AWK in shell scripting kaushys Shell Programming and Scripting 3 03-09-2006 02:40 PM
shell scripting girish_shukla SUN Solaris 1 01-02-2004 12:51 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-26-2009
vijray27 vijray27 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 2
shell scripting

Hi

I am studying shell scripting and running below script on RH Ent 3 Linux, however it is giving error. I have written script in Vi editor.

Programme condition :
If employe's basic salary is less then Rs. 1500, then HRA = 10% of basic salary and DA=90% of basic salary. If his salary is either equal to or above Rs.1500, then HRA=Rs. 500 and DA =98% of basic salary. Write a program to find gross salary.

Script:
# Calculate the gross salary of employee
echo Enter basic salary \?
read bs
if $bs -lt 1500
then
hra='echo $bs \* 10/100 | bc'
da='echo $bs \* 90/100 | bc'
else
hra=500
da='echo $bs \* 98/100 | bc'
fi
gross='echo $bs + $hra + $da | bc'
echo gross salary is $gross

Error:
./salary: line 5: 1000: command not found
gross salary is echo $bs + $hra + $da | bc

i have tried different command at line number 5. like
if [$bs -lt 1500]
if $bs < 1500
if [$bs -lt 1500]

Please suggest.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0