re: script ideas

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2003-10-31 at 12:00, Iain Buchanan wrote:
> I have a litte problem for which I'm looking for ideas.  I want to run a
> program in while loop like this:
> 
> while :; do rdesktop host; sleep 1; done
> 
> However, if I put this into a launcher on my menu:
> 
> bash -c "while :; do rdesktop host; sleep 1; done"
> 
> then when I disconnect, it reconnects again!  So I want the while loop
> to exit when I disconnect, but not if the server refuses the
> connection...
> 
> Any ideas? I guess I could try and get the return value of rdesktop, but
> I don't know how to do that in bash... yet!

The first case is when I have disabled remote connections under Windows XP. The
return value in this case is "1".

[dey@Devil dey]$ rdesktop 192.168.3.10
ERROR: connect: Connection refused
[dey@Devil dey]$ echo $?
1

Now I have enabled remote connections to Windows XP pc and then manually 
closed the rdesktop window. The return value in this case "0".

[dey@Devil dey]$ rdesktop 192.168.3.10
[dey@Devil dey]$ echo $?
0

Using the above "echo $?" you can take the exit condition and put in a 
conditional while loop instead of infinite while.

Best of luck,

-- 
Arindam Dey

The mind is not a vessel to be filled
but a fire to be kindled.

GPG FPR: B8E3 219E F129 F970 F4A7  BC50 9636 504A BEDF 5739


-- 
Shrike-list mailing list
Shrike-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux