Help - Search - Members - Calendar
Full Version: script syntax help
Linuxhelp > Support > Programming in Linux
horridon
CODE
#!/bin/bash
if [ -z "$1" ]; then
echo "Lipsa IP";
exit;
fi
i=1
ip=$1
while [ $i -le `wc -l pass_file | awk '{print $1}'` ]; do
if [ -n "$ip" ]; then
rand=`head -$i pass_file | tail -1`
user=`echo $rand | awk '{print $1}'`
pass=`echo $rand | awk '{print $2}'`

CMD=`ps -eaf | grep -c mysql`

if [ "$CMD" -lt "50" ]; then
./mysql $ip $user $pass &
else
        sleep 15
fi
    i=`expr $i + 1`

done


Output is:

CODE
./sql2: line 23: syntax error near unexpected token `done'
./sql2: line 23: `done'


Can someone fix this and paste the corrected version?
michaelk
We will help you debug your program but will not do the work for you and I hope others do the same. Besides you have not said anything about what this program does or the format / contents of the pass_file

Looks like your missing a fi for this if statement
if [ -n "$ip" ]; then
EnricTellez
Thanks for the help <a href="http://enrictellez.nl">Enric Tellez</a>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.