FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

preparation:fhhome:fhghost.html



This is an old revision of the document!


Top#Preparation

fhghost.sh

#!/bin/bash
#===========================================================
# FastHandle Grep Host
#
# fhgh.sh  "*"  hosts/xxxx     like grep PATTERN FILE
# fhgh.sh  PATTERN FILE        like grep PATTERN FILE
#
#===========================================================

case "$1" in
    -a | --all | -t | --test | -v )
        FLG="TRUE"
        shift
        ;;
    -h | --help )
        echo  "Exxample:"
        echo  "fhgh.sh  PATTERN FILE"
        echo  "fhgh.sh  "*" FILE"
        exit 0
esac


PATTERN="$1"
FILE="$2"

if [ "$FLG" = "TRUE" ]; then
    grep -Ev "^#|^$" "${FILE}"  | grep -E "${PATTERN}"
else
    grep -Ev "^#|^$" "${FILE}"  | grep -E "${PATTERN}" | awk {'print $1'}
fi


exit 0




Top#Preparation



preparation/fhhome/fhghost.html.1511707542.txt.gz ยท Last modified: 2017/11/26 23:45 by kurihara