Email: bknpk@hotmail.com Phone: +972-54-7649119
V

 

ASIC/FPGA Design and Verification Out Source Services

condition a batch bash script.

  1. This is simple if in a bash batch. It is meant for me mainly.
    In a simple script that checks in / out all files, I did not check that I am at the right directory. The results I checkout all company files and checked them in and annoyed every one. Should I have checked for the correct location, a lot of the trouble would have saved.

  2. All that is required is the following code:


  3. ptxc="/vobs/vlsi_prj/kkk/project_lib/jjj"
    p=`pwd`
    if [ "$p" == "$ptxc" ]; then
      #put your code here
    else
      #put an error message
      echo not the right path
      echo $p
      echo $ptxc
    fi

    Another example is to run some commands only on a run server and not on a login one.
    h1=`hostname`
    h2=`echo $h1 | sed "s/psv[0-9]*\([a-zA-Z_]*\)[0-9]*\..*/\1/"`
    if [ "$h2" == "log" ]; then
      echo $h1" is not a run server"
      exit
    fi
    if [ "$h2" != "run" ]; then
      echo $h1" is not a run server"
      exit
    fi
    #Put here your rest of the code

  4. A complete condition example script code is at: Condition a batch bash script

  ...


Home

vim: search a line, that does not contain a specific pattern.






Search This Site


Feedback This Site




new pages on this site