Quote:
|
Originally Posted by eagle_y2j
Help me out debug following shell scripts I hav just started learning bash but I need bug free code for my assignments hope you ppl will help me promptly 
|
to debug shell script run shell script with sh -x for eg . if ur script name is temp.sh then to debug run it as
Quote:
Q1: shell program to calculate the lucky number when a date of birth is entered by the users.
Ans
Code:
echo Enter the date of birth
read a
while [ $a - ne o]
do
r = expr $a %10
s = expr $s + $r
a = expr $a /a
done
p = expr $s %10
s = expr $s /10
p = expr$p + $s
echo Lucky no = $p
|
spaces are very important in shell scripts dont give spaces ...as well as ur using backtick(`) to assign some value to p variable....u can give some idea how this code will work ? like sample input output that would be helpful ..
this should be
i didnt get what are you trying to do ??
here ur tying to compare no with character ...or that is 0(zero) if its zero
then it should br
and for question no 3 i am not getting what do u exactly want ? anyway u can use find command to that job ... or give sample input and output to proceed further ...
btw which shell are u using ?? and which os ??