Shell study note】的更多相关文章

td p { margin-bottom: 0in } p { margin-bottom: 0.1in; line-height: 120% } a:link { } 5.1 printenv view Global variables bash new shell set Global variables and local variables export test Local → Global, so it can be accessed in both subshell and mai…
  shell learning note MAIN="/usr/local/" # 变量大写 STATUS="$MAIN/status" # 美元符加字符串是引用变量值,而美元符加数字表示命令行参数 echo "some words" >>$STATUS/log.log echo "test.sh start at `date '+%m/%d %H:%M:%S'`" >>$STATUS/log.log…
1. Translating Java Classes to Scala Classes Example 1: # a class declaration in Java public class Book{} # Scala equivalent of a class declaration class Book Example 2: # a Java class with a Construtor public class Book{ private final int isbn; priv…
1. Unified Type System Scala has a unified type system, enclosed by the type Any at the top of the hierarchy and the type Nothing at the bottom of the hierarchy. All Scala types inherit from Any. # Using Any, Book extends AnyRef, and x is an Int that…
A trait provides code reusability in Scala by encapsulating method and state and then offing possibility of mixing them into classes thus allowing code reuse. #define Trait Gliding scala> trait Gliding{ | def gliding(){ println("gliding")} |…
Scala's object-oriented collections support mutable and immutable type hierarchies. Also support functional higher-order operations such as map, filter, and reduce that let you use expression-oriented programming in collections. Higher-order operatio…
The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters and pattern matching. 1. Basic Pattern Matching In Scala, your cases can include types, wildcards, sequences, regular expressions, and so forth. scal…
1. Functional programming treats computation as the evaluation of mathematical and avoids state and mutable data. Scala encourages an expression-oriented programming(EOP) 1) In expression-oriented programming every statement is an expression. A state…
1. The three principles of OOP are encapsulation(封装性), inheritance(继承性) and polymorphism(多态性). example: class Shape{ def area: Double = 0.0 } # supertype # subtypes class Rectangle(val width: Double, val height: Double) extends Shape{ override def ar…
1. Variables (1) Three ways to define variables: 1) val refers to define an immutable variable; scala> val x = x: Int = scala> x*x res4: Int = scala> res4 + # use result as a value res6: Int = scala> res4 + res6 res7: Int = scala> x = # x i…