Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> script syntax help
horridon
post Feb 2 2015, 07:56 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 2-February 15
Member No.: 18,829



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?
Go to the top of the page
 
+Quote Post
michaelk
post Feb 2 2015, 02:29 PM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,783
Joined: 23-January 03
Member No.: 360



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
Go to the top of the page
 
+Quote Post
EnricTellez
post Dec 9 2016, 06:27 AM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 9-December 16
From: Netherlands
Member No.: 19,193



Thanks for the help <a href="http://enrictellez.nl">Enric Tellez</a>
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st February 2017 - 06:26 PM