All pastes #2073795 Raw Edit

Read FQDN from file then tracero

public shellscript v1 · immutable
#2073795 ·published 2011-06-02 18:13 UTC
rendered paste body
#!/bin/bashprocessLine(){  line="$@" # get all args  traceroute -I -z 5 -w 2 $line} ### Main script stars here #### Store file nameFILE="" # Make sure we get file name as command line argumentif [ "$1" == "" ]; then   echo "Usage: fqdn_traceroute.sh filename";   exit 0;else   FILE="$1"   # make sure file exist and readable   if [ ! -f $FILE ]; then        echo "$FILE : does not exists"        exit 1   elif [ ! -r $FILE ]; then        echo "$FILE: can not read"        exit 2   fifi# read $FILE using the file descriptors # Set loop separator to end of lineBAKIFS=$IFSIFS=$(echo -en "\n\b")exec 3<&0exec 0<"$FILE"while read -r linedo        # use $line variable to process line in processLine() function        processLine $linedoneexec 0<&3 # restore $IFS which was used to determine what the field separators areIFS=$BAKIFSexit 0