[X-Unix] Bash scripting Question

Lasse jakobsen.lasse at euro.apple.com
Tue Aug 22 13:51:09 PDT 2006


Hi Russell,

while variable x is not equal to zero, do whatever need doing,  
increment/decrement variable x, done

Or is it something else you're looking for?

oh, and make sure to put a line in your while statement for updating  
variable x,
one normal  way would be like

>> while	[ $x -ne 0 ]; do
>> 			 fmsadmin status Clients
				let "x = $x + 1"
>> 		done

this will increment x with 1 every time. Lets say you want to ping  
each host on a specific subnet, this would then be done as
#!/bin/bash
declare ADDRESS="192.165.196."
declare PING="/sbin/ping"

x=0;
while	[ $x -lt "255" ]; do
		$PING -c 3 "$ADDRESS""$x";
		let "x = $x + 1";
done

and substitute t fit your needs. Does this help?

Cheers
/L
Den 22/08/2006 kl. 17.29 skrev Russell McGaha:

> Lasse;
> 	Okay, THANKS.  uhh could/would you explain what's going on there??
>
>
> Thanks again
> Russell
>
> On Aug 22, 2006, at 11:16 AM, Lasse wrote:
>
>> Hi Russell,
>>
>> this should do it
>>
>> 		while	[ $x -ne 0 ]; do
>> 			fmsadmin status Clients
>> 		done
>>
>> Cheers
>> /L
>>
>> Den 22/08/2006 kl. 17.11 skrev Russell McGaha:
>>
>>> Folks;
>>> 	I've got a situation where I running a script and need to wait  
>>> till the output of a command is null:
>>>
>>> ex.
>>> 	NotNull = true
>>> 	While NotNull
>>> do
>>> 	fmsadmin status Clients   #[returns a list of connected clients;  
>>> I'd like to got thru
>>> 							  this loop until either the output of the command is null or
>>> 							  About 2-5 minutes have gone by]#
>>> done
>>>
>>> Can anyone give ANY pointers or examples on how to do this?
>>>
>>> Russell
>>>
>>> PS. I'm on the digests so PLEASE cc me directly
>>> _______________________________________________
>>> X-Unix mailing list
>>> X-Unix at listserver.themacintoshguy.com
>>> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix
>>>
>>> Listmom is trying to clean out his closets! Vintage Mac and  
>>> random stuff:
>>>         http://search.ebay.com/_W0QQsassZmacguy1984
>>
>



More information about the X-Unix mailing list