linux custom function

  Travel with someone else's car, always feel awkward, how to customize your wheels it?

  

 

      By the above examples, and the sum of two parameters, we can learn the basic steps define a function,

  

  function getSum(){
     SUM=$[$n1+$n2]
     echo "n1 + n2 = $SUM"
   }

  getSum is the name of the function, n1, n2 is a function of the variables (parameters)

  After a good function design, read through the read function parameters from the console, read -t waiting time (sleep) 10, read -p "message" parameter will not elaborate here read, after all, a very simple thing.

  After the function to write, how to call it?

  It is very simple, function name Parameter 1 Parameter 2

  On it.

 

 

   linux is a magical system.

Guess you like

Origin www.cnblogs.com/SliverLee/p/11441196.html