0

bash:

#!/bin/bash

DOMAIN=mydomain.com

for client in ServerA ServerB ServerC ServerD
do
xhost +$client.$DOMAIN
done


MS-DOS:
@echo off
for..... crap.....

I can't seem to get the for loop to work properly. Has anyone had much experience with batch files in DOS? I realize that running xhost inside of a batch file sounds silly, but there is a need for it in this situation. :)

I wouldn't doubt if the first response is RTFM, or whatever, but there is no "man" in ms-dos, and doing "for /?" didn't help at all. :)

2
Contributors
5
Replies
6
Views
13 Years
Discussion Span
Last Post by liliafan
0

Hi I think the following should work:

SET DOMAIN=mydomain.com
FOR %%A IN (ServerA ServerB ServerC ServerD) DO xhost +%%A%.%DOMAIN%

You may need to play with it a little to get it working exactly right but that is the basic syntax.

HTH

Ben

0

That yields the same problem that I was having:

%%A was unexpected at this time.

Hmmmm running on windows XP that works fine, what version of windows are you using?

Additionally is this from a bat file or are you testing on the commandline? On the command line %%A becomes %A.

From checking for / do on commandline requires an NT class OS.

0

Using Windows 2000 server. I was testing it at the command line. That was the problem. Thanks!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.