![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| check the directory exist | ust | Shell Programming and Scripting | 7 | 09-22-2008 09:49 PM |
| Check if certain files exist in a directory, if not add name to a textfile | SunnyK | Shell Programming and Scripting | 1 | 02-07-2008 09:21 AM |
| how to check if directory/file exist using c/c++ | steven88 | High Level Programming | 2 | 01-03-2006 02:55 AM |
| how to check if directory/file exist using c/c++ | steven88 | Shell Programming and Scripting | 1 | 01-02-2006 10:45 PM |
| how to check if the file exist or not? | gusla | UNIX for Dummies Questions & Answers | 3 | 03-27-2002 10:56 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How to check directory exist on servers
There are many servers and their directory structer should be exactly the same. To check the directory path for all servers, I wrote a script. Code:
#! /bin/ksh
ARRAY_DIRECTORIES[1]="/c/dev/custom/bin"
ARRAY_DIRECTORIES[2]="/c/dev/db/custom/src"
ARRAY_ENV[1]="remoteName200"
ARRAY_ENV[2]="remoteName201"
ARRAY_ENV[3]="remoteName202"
integer DIR_INDEX=0
integer ENV_INDEX=0
while(($ENV_INDEX<3))
do
ENV_INDE=`expr $ENV_INDE+1`
ssh "${ARRAY_ENV[$ENV_INDE]}"
while (($DIR_INDEX<2))
do
DIR_INDEX=`expr $DIR_INDEX + 1`
if [ ! -d "${ARRAY_DIRECTORIES[$DIR_INDEX]}" ]
then
#do something
fi
done
done
I am new to Shell Scripting, maybe I am doing something really stupid and need your help. The script does ssh to the server without asking for password (I put a ssh key to .ssh directory.) Thanks Mike |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|