参考:
例如:
#include <stdio.h>
void main(void)
{
printf("Hello the world!\n\r");
}
language | key |
---|---|
C | c |
ActionScript | actionscript |
Apache | apache |
AppleScript | applescript |
AsciiDoc | asciidoc |
AspectJ | asciidoc |
AutoHotkey | autohotkey |
AVR Assembler | avrasm |
Axapta | axapta |
Bash | bash |
BrainFuck | brainfuck |
Cap’n Proto | capnproto |
Clojure REPL | clojure |
Clojure | clojure |
CMake | cmake |
CoffeeScript | coffeescript |
C++ | cpp |
C# | cs |
CSS | css |
D | d |
Dart | d |
Delphi | delphi |
Diff | diff |
Django | django |
DOS.bat | dos |
Dust | dust |
Elixir | elixir |
ERB(Embedded Ruby) | erb |
Erlang REPL | erlang-repl |
Erlang | erlang |
FIX | fix |
F# | fsharp |
G-code(ISO 6983) | gcode |
Gherkin | gherkin |
GLSL | glsl |
Go | go |
Gradle | gradle |
Groovy | groovy |
Haml | haml |
Handlebars | handlebars |
Haskell | haskell |
Haxe | haxe |
HTML | html |
HTTP | http |
Ini file | ini |
Java | java |
JavaScript | javascript |
JSON | json |
Lasso | lasso |
Less | less |
Lisp | lisp |
LiveCode | livecodeserver |
LiveScript | livescript |
Lua | lua |
Makefile | makefile |
Markdown | markdown |
Mathematica | mathematica |
Matlab | matlab |
MEL (Maya Embedded Language) | mel |
Mercury | mercury |
Mizar | mizar |
Monkey | monkey |
Nginx | nginx |
Nimrod | nimrod |
Nix | nix |
NSIS | nsis |
Objective C | objectivec |
OCaml | ocaml |
Oxygene | oxygene |
Parser 3 | parser3 |
Perl | perl |
PHP | php |
PowerShell | powershell |
Processing | processing |
Python’s profiler output | profile |
Protocol Buffers | protobuf |
Puppet | puppet |
Python | python |
Q | q |
R | r |
RenderMan RIB | rib |
Roboconf | roboconf |
RenderMan RSL | rsl |
Ruby | ruby |
Oracle Rules Language | ruleslanguage |
Rust | rust |
Scala | scala |
Scheme | scheme |
Scilab | scilab |
SCSS | scss |
Smali | smali |
SmallTalk | smalltalk |
SML | sml |
SQL | sql |
Stata | stata |
STEP Part21(ISO 10303-21) | step21 |
Stylus | stylus |
Swift | swift |
Tcl | tcl |
Tex | tex |
text | text/plain |
Thrift | thrift |
Twig | twig |
TypeScript | typescript |
Vala | vala |
VB.NET | vbnet |
VBScript in HTML | vbscript-html |
VBScript | vbscript |
Verilog | verilog |
VHDL | vhdl |
Vim Script | vim |
Intel x86 Assembly | x86asm |
XL | xl |
XML | xml |
YAML | yml |
init进程是Android系统中用户空间的第一个进程,进程ID为1,源代码位于system/core/init 目录。作为Android系统的第一个进程,Init进程承担这很多重要的初始化任务,一般Init进程的初始化可以分为两部分,前半部分挂载文件系统,初始化属性系统和Klog, selinux的初始化等,后半部分重要通过解析init.rc来初始化系统daemon服务进程,然后以epoll的监控属性文件,系统信号等。
init.rc则是init进程启动的配置脚本,这个脚本是用一种叫Android Init Language(Android初始化语言)的语言写的。在7.0以前,init进程只解析根目录下的init.rc文件,但是随着版本的迭代,init.rc越来越臃肿,在7.0以后,init.rc一些业务被拆分到
/system/etc/init
/vendor/etc/init
/odm/etc/init
三个目录下。
AIL包括四种类型的语句:
语法特性
Actions是被命名的命令(Commands)序列,由trigger(触发器)来决定这个actions什么时候发生,当一个时间触发了一个符合的action触发器,这个action就会被添加到处理队列尾部(它已经存在在对列除外)。
在处理队列中每一个action都按照排序出列,action中的command也按照顺序执行:
on <trigger> ##触发条件
<command> ##执行命令
<command> ##可以同时执行多个命令
<command>
trigger
init.rc中常见的trigger如下:
| trigger(触发器) | 功能 |
|-|-|
| boot | 这是init启动时(加载/init.conf之后)发生的第一个触发器。|
| <name>=<value> | 当属性<name>设置为特定值<value>时,会触发此触发器 |
| device-added-<path>
device-removed-<path> | 当添加或删除设备节点时,会触发这些触发器。|
| service-exited-<name> | 当指定服务退出时,将触发这些触发器。|
两种常见的Action定义代码:
#当init被触发时执行
on init
<command>
...
#当属性sys.boot_completed被设置为1时执行
on property:sys.boot_completed=1
<command1>
在写shell脚本的时候发现cd切换目录的时候无法切换,还是在当前目录下,这是什么原因呢?
#!/bin/bash
TOP=`pwd`
cd ${TOP}/../XXXXX/rcar-xos/v3.3.0/
ls -l
可以使用下述命令去执行我们的脚本即可。
# way - 1
$ source xxx.sh
# way - 2
# note: . ./xxx.sh .和.中间有个空格!
$ . ./xxx.sh