Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Tuesday, April 14, 2015

gitdiff script





~xviengu/w/dlb D01_XVIENGU_TESTTOOL_PEXPU_IPV6 /vobs/axeiv/test_applications
[xviengu@dekt1 xviengu_tt_apz22 /vobs/axeiv]$ cat ~xviengu/w/dlb
#!/bin/sh

BR="$1"
shift
cleartool find "$@" -ver "lbtype($BR)" -type f -print |
         sed 's,\(.*\)/\([0-9][0-9]*\)$,\1/0 \1/\2,' |
        while read base new; do
                if [ -x /usr/bin/git ]; then
                        /usr/bin/git --no-pager diff --stat --no-index --color "$base" "$new"
                else
                        cleartool diff -columns 200 "$base" "$new"
                fi
        done |
        less -FRX
[xviengu@dekt1 xviengu_tt_apz22 /vobs/axeiv]$


Or


[xviengu@dekt1 xviengu_tt_pexpu_ipv6 home/xviengu/3512Transfer]$ cat ~xtunngu/bin/dif
#!/bin/sh
if [ ! -d "/tmp/$USER" ]; then
  mkdir "/tmp/$USER"
else
  rm -rf  "/tmp/$USER/*"
fi

param1="$1"
param2="$2"
LABEL=""

if [ -z "$param1" ]; then
 echo "parameter is invalid"
 exit
fi

while getopts l:h OPTION
do
   case "$OPTION" in
        l)
           LABEL="$OPTARG"
           ;;
        h)
           ;;
   esac
done

echo "$LABEL"
if [ ! -z "$LABEL" ]; then
   echo "create directories to copy ... "

   if [ ! -d "/tmp/$USER/base" ]; then
     mkdir /tmp/$USER/base
   else
     rm -rf /tmp/$USER/base
     mkdir /tmp/$USER/base
   fi

   if [ ! -d "/tmp/$USER/$LABEL" ]; then
     mkdir /tmp/$USER/$LABEL
   else
     rm -rf /tmp/$USER/$LABEL
     mkdir /tmp/$USER/$LABEL
   fi

   Exist=0 # exist counter
   echo "copying files to /tmp/$USER and comparing ..."
   cleartool find "$3" -ver "lbtype($LABEL)" -type f -print |
  # cleartool find "$3" -version 'version($LABEL)' -print |
    sed 's,\(.*\)/\([0-9][0-9]*\)$,\1/0 \1/\2,' |
     while read base new; do
       #echo "[BASE] cp $base /tmp/$USER/base/`echo $base | sed 's,@@\(.*\), ,' | sed 's,\(/.*/\),,'`"
       if [ ! -f  "/tmp/$USER/base/`echo $base | sed 's,@@\(.*\),,' | sed 's,\(/.*/\),,'`" ]; then
          yes | cp $base "/tmp/$USER/base/"`echo $base | sed 's,@@\(.*\),,' | sed 's,\(/.*/\),,'`
       else
          yes | cp $base "/tmp/$USER/base/`echo $base | sed 's,@@\(.*\),,' | sed 's,\(/.*/\),,'`.0"
       fi

       if [ ! -f  "/tmp/$USER/$LABEL/`echo $new | sed 's,@@\(.*\),,' | sed 's,\(/.*/\),,'`" ]; then
          yes | cp $new "/tmp/$USER/$LABEL/"`echo $new | sed 's,@@\(.*\),,' | sed 's,\(/.*/\),,'`
       else
          yes | cp $new "/tmp/$USER/$LABEL/`echo $new | sed 's,@@\(.*\),,' | sed 's,\(/.*/\),,'`.0"
       fi

     # echo "[LABEL] cp $new /tmp/$USER/$LABEL/`echo $new | sed 's,@@\(.*\), ,' | sed 's,\(/.*/\),,'`"
     done

     vi "+DirDiff /tmp/$USER/$LABEL/ /tmp/$USER/base/"
     exit
fi

#update later for code review for VM on APZ_VM3
if [ -z "$param2" ]; then


  if [ "$(ls -A /vobs/APZ_VM3)" ]; then
    cleartool lsco -me -cview -r -fmt "%En@@%[version_predecessor]p\n" /vobs/APZ_VM3 | sed 's,\(.*\)/\([0-9][0-9]*\)$,\1/0 ,' |
    while read base; do
      yes |  cp $base  "/tmp/$USER/"`echo $base| sed 's,@@\(.*\), ,' | sed 's,\(/.*/\),,'`
    done
  else
    echo "view isnot set"
    exit
  fi

  echo "compare entered directory files with checked out files"
  vi "+DirDiff $param1 /tmp/$USER"

else
 vi "+DirDiff $param1 $param2"
fi
[xviengu@dekt1 xviengu_tt_pexpu_ipv6 home/xviengu/3512Transfer]$




Friday, April 4, 2014

C shell basic







The C Shell recognizes the following operators, in order of precedence.

     ()       - parenthesis - change order of evaluation
     -        - unary minus/negation
     ~        - one's complement
     !        - logical negation
     %        - remainder
     /        - divide
     *        - multiply
     -        - subtract
     +        - addition
     >>       - shift right
     <<       - shift left
     >        - greater than
     <        - less than
     >=       - greater than or equal
     <=       - less than or equal
     !=       - not equal to (strings)
     ==       - equal to (strings)
     &        - bitwise AND 
     ^        - bitwise exclusive OR
     |        - bitwise inclusive OR
     &&       - logical AND
     ||       - logical OR

Ref: 1 2



Labels