get_mapped_host
Purpose:
-
Retrieve and print the hostname associated with a specified keyword from a mapping file.
Enter:
-
get_mapped_host <keyword>
Where:
-
keyword
Specify the keyword string used to look up and retrieve the corresponding hostname.
If the keyword is not known, it can be determined by looking at the file /data/cell_map_location or enter the command ‘map_keywords’.
Example:
-
get_mapped_host @SPECS_DEF_NODE
The above command results in ‘ctcnode4’ being printed on STD_OUT.
Notes:
-
If no keyword is provided, the program outputs ‘NO KEYWORD ENTERED’ and exits with a non-zero status.
The following is an example of how to use this command in a script file called “gethost” that needs to know where the world drive is located.
——————————————————————————-
#!/bin/sh
hostname=’get_mapped_host $1′
if [ “$hostname” = ‘NOT FOUND’ ]
then
echo get_mapped_host could not find keyword=$1
exit
else
if [ “$file” = ‘NO KEYWORD ENTERED’ ]
then
echo Missing KEYWORD argument to get_mapped file
exit
fi
fi
# do what ever you need to do
.
.
——————————————————————————
To use the above script, enter the following in the command line:
gethost @SPECS_DEF_NODE