writebook.sh

来自「南京航空航天大学开发的一个类Unix和Linux的操作系统,好不好看看就知道了,」· Shell 代码 · 共 116 行

SH
116
字号
#!/bin/sh# run this script at the kernel source top directoryesc_(){        echo $1 | sed -e 's/_/\\_/g'}subdirof(){        find $1 -maxdepth 1 -mindepth 1 -type d -exec basename '{}' ';'}subregof(){        find $1 -maxdepth 1 -mindepth 1 -type f -exec basename '{}' ';'}sortmakefile(){        local head        result=''        for i ; {        	if [ $i = "Makefile" ] ; then        		head="Makefile"        	else        		result=$result" "$(echo $i)        	fi        }        result=$head$result}writefile(){        echo '\verbatimtabinput[8]{'$1'}'}writesection(){        echo '\section{'$(esc_ $2)'}'        writefile $1/$2 }writesubsection(){        echo '\subsection{'$(esc_ $3)'}'        writefile $1/$2/$3}writesubdir() #(chapter,section,subsection){        echo '\section{'$(esc_ $2)'}'        sortmakefile $(subregof $1/$2)        for i in $result; {        	writesubsection $1 $2 $i        }        echo}writechapter(){        echo '\chapter{'$1'}'        sortmakefile $(subregof $1)        for i in $result; {        	writesection $1 $i        }	        for i in $(subdirof $1); {        	writesubdir $1 $i        }        echo}writemakefile(){        echo '\chapter{Makefile}'        writefile Makefile        echo '\chapter{Rules.make}'        writefile Rules.make}main(){echo '\documentclass[12pt,a4paper,twoside]{book}\usepackage{verbatim}\usepackage{moreverb}\addtolength{\voffset}{-2cm}\addtolength{\textheight}{3cm}\addtolength{\hoffset}{-1cm}\addtolength{\textwidth}{2cm}\setlength{\evensidemargin}{10pt}\begin{document}\tableofcontents\frontmatter'        writemakefile        echo '\mainmatter'        writechapter boot        writechapter init        writechapter lib        writechapter asm        writechapter mm         writechapter fs        writechapter kern        writechapter net        writechapter dev        echo '\end{document}'}main > unixlite.texlatex unixlite latex unixlite dvipdf unixlite 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?