不能将引用的字符串作为参数传递给javadoc

时间:2013-07-16 04:46:52

标签: linux bash shell

我正在尝试创建一个简单的脚本来从我的java源代码生成javadoc。 这是脚本代码:

#!/bin/sh
WINDOWTITLE='My Fancy Documentation'
DOCTITLE='Generator<sup><font size="-2">TM</font></sup> Productions'
HEADER='<b> Fancy API </b>'
BOTTOM='This material is protected under international copyright laws. Do not copy.<p>Copyright &copy; 2013 Generator Productions. All rights reserved.'
SRCDIR='../src/api/'
DSTDIR='./'

javadoc -sourcepath $SRCDIR -d $DSTDIR -use -splitIndex -windowtitle $WINDOWTITLE -doctitle $DOCTITLE -header $HEADER -bottom $BOTTOM com.generator.electricity

当我执行脚本时,我收到以下错误:

javadoc: error - Illegal package name: "size="-2">TM</font></sup>"
javadoc: error - Illegal package name: "Productions""
javadoc: error - Illegal package name: "</b>"
javadoc: error - Illegal package name: "laws."
javadoc: error - Illegal package name: "copy.<p>Copyright"
javadoc: error - Illegal package name: "&copy;"
javadoc: error - Illegal package name: "2013"
javadoc: error - Illegal package name: "Productions."
javadoc: error - Illegal package name: "reserved."
Loading source files for package Fancy...
javadoc: warning - No source files for package Fancy
Loading source files for package Documentation...
javadoc: warning - No source files for package Documentation
Loading source files for package Fancy...
javadoc: warning - No source files for package Fancy
Loading source files for package API...
javadoc: warning - No source files for package API
Loading source files for package material...
javadoc: warning - No source files for package material
Loading source files for package is...
javadoc: warning - No source files for package is
Loading source files for package protected...
javadoc: warning - No source files for package protected
Loading source files for package under...
javadoc: warning - No source files for package under
Loading source files for package international...
javadoc: warning - No source files for package international
Loading source files for package copyright...
javadoc: warning - No source files for package copyright
Loading source files for package Do...
javadoc: warning - No source files for package Do
Loading source files for package not...
javadoc: warning - No source files for package not
Loading source files for package Generator...
javadoc: warning - No source files for package Generator
Loading source files for package All...
javadoc: warning - No source files for package All
Loading source files for package rights...
javadoc: warning - No source files for package rights
Loading source files for package com.generator.electricity...
javadoc: warning - No source files for package com.generator.electricity
9 errors

有什么建议我怎样才能完成这件事?

1 个答案:

答案 0 :(得分:0)

<块引用>

我怎样才能完成这件事?

在 shell 中,要在程序中正确传递变量,您必须引用变量扩展,以禁用分词和文件名扩展。

javadoc -sourcepath "$SRCDIR" -d "$DSTDIR" -use -splitIndex -windowtitle "$WINDOWTITLE" -doctitle $DOCTITLE -header "$HEADER" -bottom "$BOTTOM" com.generator.electricity

记得用 http://shellcheck.net

检查你的脚本