Co jest nie tak w moim kodzie?Nieoczekiwany błąd operatora
#!/bin/sh
LOOK_FOR="$1"
for i in `find $2 -name "*jar"`; do
echo "Looking in $i ..."
#jar tvf $i | grep $LOOK_FOR > /dev/null
jar tvf "$i" | grep "$LOOK_FOR"
if [ $? == 0 ] ; then
echo "==> Found \"$LOOK_FOR\" in $i"
fi
done #line 13
Wyjście
[email protected]:$ sh lookjar.sh org/apache/axis/message/addressing/EndpointReference /media/0C06E20B06E1F61C/uengine/uengine
Looking in /media/0C06E20B06E1F61C/uengine/uengine/defaultcompany/build/uengine_settings.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/defaultcompany/WebContent/uengine-web/lib/FCKeditor/WEB-INF/lib/commons-fileupload.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/defaultcompany/WebContent/uengine-web/lib/FCKeditor/WEB-INF/lib/FCKeditor-2.3.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/defaultcompany/WebContent/uengine-web/processmanager/signedmetaworks.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/hsqldb/lib/hsqldb.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/hsqldb/lib/servlet.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/src/lib/commons-discovery.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/src/lib/google.jar ...
[: 13: 1: unexpected operator
Looking in /media/0C06E20B06E1F61C/uengine/uengine/src/lib/jxl.jar ...
dlaczego Jaka jest różnica? – kapitanluffy
@kapitanluffy [Ponieważ standard tak mówi.] (Http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html) Określa, co '=' robi, ale '==' nie jest w ogóle wymienione i dlatego jest nieważny. –
Oh, był zdezorientowany, ponieważ widzę skrypty, które używają "==" zamiast "=" – kapitanluffy