Shashikant shah

Friday, 9 October 2015

script for insert variable to other tty

#!/bin/bash
COMMAND=$1
OBJ_SEQUENCE_NUM=$2
RUN_COMMAND=$(echo "$COMMAND" | tr '[a-z]' '[A-Z]')
file="/tmp/update_obj.txt"

if [[ ! -f $file ]];then
    echo "$file not found."
else
    remove=$(rm -rf /tmp/update_obj.txt)
fi
    case $RUN_COMMAND in
        "COMPLETE")
        echo "comlete comand exc $2."
        ;;
        "FAIL")
        echo "fail comand exc $2."
        ;;
        *)
        echo "invaild command."
        exit 0
        ;;
esac

arr=$(echo $OBJ_SEQUENCE_NUM | tr "," "\n")

for i in $arr
do
create_file=$(echo "$RUN_COMMAND $i" >> /tmp/update_obj.txt)
all_command=$(cat /tmp/update_obj.txt)
done

sleep 1

. ./OBJCmdLineadmin.ksh << EOF > update.log
    $all_command
    exit
EOF
=========================================

script.sh complete 7673254,87328

No comments:

Post a Comment