英语翻译请高手帮忙看看下面一段shell脚本是什么意思.9 dm=10 for d in /usr/man /usr/share/man /usr/X11R6/man /usr/local/man11 do12 if [ -d $d ]; then13 if [ x$dm = x ]; then dm=$d; else dm=$dm:$d; fi14 fi15 done16 DEFMANPATH=$dm17

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/14 02:47:13
英语翻译请高手帮忙看看下面一段shell脚本是什么意思.9 dm=10 for d in /usr/man /usr/share/man /usr/X11R6/man /usr/local/man11 do12 if [ -d $d ]; then13 if [ x$dm = x ]; then dm=$d; else dm=$dm:$d; fi14 fi15 done16 DEFMANPATH=$dm17

英语翻译请高手帮忙看看下面一段shell脚本是什么意思.9 dm=10 for d in /usr/man /usr/share/man /usr/X11R6/man /usr/local/man11 do12 if [ -d $d ]; then13 if [ x$dm = x ]; then dm=$d; else dm=$dm:$d; fi14 fi15 done16 DEFMANPATH=$dm17
英语翻译
请高手帮忙看看下面一段shell脚本是什么意思.
9 dm=
10 for d in /usr/man /usr/share/man /usr/X11R6/man /usr/local/man
11 do
12 if [ -d $d ]; then
13 if [ x$dm = x ]; then dm=$d; else dm=$dm:$d; fi
14 fi
15 done
16 DEFMANPATH=$dm
17 dc=
18 for d in /usr/man/preformat /usr/man /usr/share/man/preformat /usr/share/man
19 do
20 if [ -d $d ]; then
21 if [ x$dc = x ]; then dc=$d; else dc=$dc:$d; fi
22 fi
23 done
24 DEFCATPATH=$dc
25
26 # make a single big /var/cache/man/whatis file,
27 DEFWHATISDIR=/var/cache/man
28 DEFWHATIS=$DEFWHATISDIR/whatis
29
30 AWK=/bin/awk
31
32 # Find a place for our temporary files.
33
34 if TMPFILE=$(mktemp /tmp/whatis.XXXXXX)
35 then
36
37 # make sure TMPFILE is deleted if program is killed or terminates
38 # (just delete this line if your shell doesnt know about trap)
39 trap "rm -rf $TMPFILE" 0
40 trap "rm -rf $TMPFILE; exit 255" 1 2 3 15

英语翻译请高手帮忙看看下面一段shell脚本是什么意思.9 dm=10 for d in /usr/man /usr/share/man /usr/X11R6/man /usr/local/man11 do12 if [ -d $d ]; then13 if [ x$dm = x ]; then dm=$d; else dm=$dm:$d; fi14 fi15 done16 DEFMANPATH=$dm17
将/usr/man /usr/share/man /usr/X11R6/man /usr/local/man
变成dm=/usr/man:/usr/share/man:/usr/X11R6/man:/usr/local/man,
当然程序判断如果非正常目录就不加到dm变量里了,
然后DEFMANPATH=$dm
dc同理
后面没干啥事儿,定义了一个trap陷阱处理命令.