Advertisement

05.10.2008 at 08:29AM PDT, ID: 23391739
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

Please Debug it if it has errors, and provide me output

Asked by sonicefu in Shell Scripting, Unix Operating Systems

Hi Unix Experts,

Please check following shell script for "Room Booking",

1) debug it if it has errors
2) and reply me the output please

Thanking in Advance...................
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
#!/bin/sh       # Tells the OS (Operating System) to use the Bourn Shell 
 
booking()        # Function called welcome.
{
clear           # Clears the screen as soon as the script starts.
 
echo ""         # Echo's blank lines to screen.
echo ""
echo ""
echo " ***************************Welcome to Room Booking Services*****************************"
echo ""
 
date +"You are logged in at $HOSTNAME, as $USER. It is %c"
 
echo "Please Enter Name >>>\c"    #Waits for user to enter information.
read NAME                         #Reads information entered, and puts
                                  #it into NAME  (a variable)
 
echo "Please Enter No. of Days >>>\c"    #Waits for user to enter information.
read DAYS                         	 #Reads information entered, and puts
                                  	 #it into DAYS  (a variable)
 
echo "Please Chose Size of Room >>>\c"    
echo "     S or s ? Single Bed"
echo "     D or d ? Double Bed"
echo "     T or t ? Double Bed >>>\c"     #Waits for user to enter information.
read SIZE                         	 #Reads information entered, and puts
                                  	 #it into SIZE (a variable)
 
if [ $SIZE -eq "s" | $SIZE -eq "S" ]
then
    echo val = $DAYS * 150
elif [ $SIZE -eq "d" | $SIZE -eq "D" ]
then
        echo val = $DAYS * 210
elif [ $SIZE -eq "t" | $SIZE -eq "T" ]
then
    echo val = $DAYS * 250
else 
    echo "Invalid Size Was Selected"
fi
 
echo " ***************************Billing Details are as Follows*****************************"
echo ""
echo "Customer Name:  "
echo $NAME
echo "No. of Days:  "
echo $val
echo "Total Calculated Amount:  "
echo $val
 
}           # End of function called booking
 
# Below is the  Start of the main body of program (the while loop)
 
 
clear            # Clears the screen
 
while true       # True is a statement that returns true (1).  So by saying
do               # while true  it is like saying "do this until something 
                 # happens to be false (like hitting ctrl C or delete)
    echo ""
    echo ""
    echo "			Room Booking Services"
    echo ""
    echo ""
    echo ""
    echo "		1. Make a Room Booking"  
    echo "		2. Exit From the System
    echo ""
    echo "Enter Option >>>\c"        
        
 
read ANS           # Waits for user to enter something
                   # and stores the input in $ANS
 
case $ANS in 
 
	1 )  booking;;           # If $ANS is 1 call booking 
 
	2 )  clear; exit;;      # If $ANS is 2 clear screen and exit
              
        * ) echo "INVALID CHOICE!"; sleep 2; clear;;  # Echo the error message
                                                      # sleeps 2 seconds and 
 					              # clears the screen
esac    
done
 
Loading Advertisement...
 
[+][-]05.10.2008 at 11:42AM PDT, ID: 21540115

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.10.2008 at 11:48AM PDT, ID: 21540129

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.10.2008 at 11:55AM PDT, ID: 21540149

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Shell Scripting, Unix Operating Systems
Sign Up Now!
Solution Provided By: omarfarid
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.10.2008 at 01:01PM PDT, ID: 21540332

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628