![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| using ssh with a for loop | din | Shell Programming and Scripting | 4 | 03-05-2009 03:32 AM |
| while loop inside while loop | panknil | Shell Programming and Scripting | 0 | 01-07-2008 12:49 PM |
| for loop help | smtpgeek | Shell Programming and Scripting | 12 | 11-09-2005 08:04 PM |
| while loop | whited05 | Shell Programming and Scripting | 2 | 11-03-2005 12:27 PM |
| how to get the similar function in while loop or for loop | trynew | Shell Programming and Scripting | 3 | 06-17-2002 12:09 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Until loop
Hi
I just want to know if this until loop is write because my script is not working and I don't know where is my error and maybe it's in this until cicle until [ ! `cat svn.txt` -eq $pname ] do ... done So basicly I want to know if I can execute that command (cat svn.txt) and if the syntax is write Thanks in advance |
|
||||
|
Quote:
__________________________________________ Code:
#!/bin/sh
user=`whoami`
pname="svn `whoami`"
var=0
LOGFILE=`mktemp -t svn_checkout.XXXXXX`
ICONPATH="`dirname $0`/svn.xpm"
list=`ssh $user@192.168.1.3 "ls /esp-server/svn"`
URL=`zenity --entry --title="Subversion: Checkout" --text="$list
Enter repository folder according to the the aboves:" --entry-text="" --width=400 --window-icon="$ICONPATH" 2>&1`
#So until where is everything ok and my script work as I want. The problem was when #I wanted to add a progress bar to my script
if [ $? -eq 0 ]
then
svn checkout svn+ssh://$user@192.168.1.3/esp-server/svn/$URL &> $LOGFILE & pid1=$!
zenity --progress --pulsate --auto-kill & pid2=$!
while [ $var -lt 1 ]
do
ps aux | awk '{ print $11 " " $1 }' | grep svn > svn.txt
#until where is also ok
infile=`cat svn.txt`
echo $infile
until [[ "`cat svn.txt`" -eq "$pname" ]]
do
#then when it enters where I'm not sure if it works. Like, I know it goes inside the until #because the echo in the next lines are "echoed", but the until never stops and thats #very confusing because my condition is until "`cat svn.txt`" -eq "$pname" and after the svn command is done, the svn.txt is empty and so
#[["`cat svn.txt`" -eq "$pname" ]] is true and so should go out from the until
echo $infile
echo $pname
ps aux | awk '{ print $11 " " $1 }' | grep svn > svn.txt ;
done
$var=2 #this is for exit the while
kill $pid2 # and this to kill the progress bar
done
rm -f svn.txt
rm -f $LOGFILE
fi
and by the way, my verbose says error line 44 which is the last if. why Please help thanks in advance Last edited by ruben.rodrigues; 03-16-2009 at 04:59 AM.. |
|
||||
|
Quote:
just tell me one thing if you know I have a second script that looks more simple Code:
#!/bin/sh
user=`whoami`
pname="svn `whoami`"
var=0
LOGFILE=`mktemp -t svn_checkout.XXXXXX`
ICONPATH="`dirname $0`/svn.xpm"
list=`ssh $user@192.168.1.3 "ls /esp-server/svn"`
URL=`zenity --entry --title="Subversion: Checkout" --text="$list
Enter repository folder according to the the aboves:" --entry-text="" --width=400 --window-icon="$ICONPATH" 2>&1`
if ($? == 0) then
svn checkout svn+ssh://$user@192.168.1.3/esp-server/svn/$URL &> $LOGFILE
zenity --progress --pulsate --auto-kill & pid=$!
echo "`ps aux | awk '{ print $11 " " $1 }' | grep svn`"
echo "before while"
while [ "`ps aux | awk '{ print $11 " " $1 }' | grep svn`" -eq "svn ruben"]
do
echo "`ps aux | awk '{ print $11 " " $1 }' | grep svn`"
echo "I'm inside the while"
done
kill $pid
fi
echo "end"
but when I execute it gives me this Checkout2: 26: 0: not found end # the end is from the echo and the line 26 is the fi Why man? like I think that my only error |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|