User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Plz to fix bash script Page [1]  
wwwebsurfer
All American
10217 Posts
user info
edit post

#!/bin/bash
#Project 5/2

echo "test1"
if [[ -n $5 ]]
then
echo "test2"
if [[ -z "$6" ]]
then
echo "test3"
echo "$1 $2 $3 $4 $5 $((($1+$2+$3+$4+$5)/5))"
else
echo "test4"
echo "You have entered over 5 values"
fi
echo "test5"
else
echo "test6"
echo "Please enter 5 values"
fi
echo "test7"


Supposed to accept only 5 values from command line and then output them and average them. It currently gives retarded errors that make no sense

[Edited on May 10, 2010 at 8:20 PM. Reason : @#)(* - tech talk. sorry]

5/10/2010 8:20:26 PM

Optimum
All American
13716 Posts
user info
edit post

try rebooting

5/10/2010 8:21:16 PM

Kickstand
All American
11962 Posts
user info
edit post

plz to fix sash bcript

5/10/2010 8:23:50 PM

wwwebsurfer
All American
10217 Posts
user info
edit post

lol, thanks for the useless responses... where the cops mods when you need them?

5/10/2010 8:26:45 PM

simonn
best gottfriend
28968 Posts
user info
edit post

#!/bin/bash
if [ $# -ne 5 ]; then
echo "Please enter 5 values"
else
echo "$(( ($1 + $2 + $3 + $4 + $5)/5 ))"
fi

5/10/2010 8:46:26 PM

smoothcrim
Universal Magnetic!
18983 Posts
user info
edit post

back ticks homey

5/10/2010 8:51:42 PM

 Message Boards » Chit Chat » Plz to fix bash script Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2025 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.