This is my build script, I calls this script from main build script, in case of SUCCESS, everything is ok, but in failure, I do "return 1", so that main build can cheque "$?" and based on that it prints success or not, but here "return 1", throwa an error "./build: line 17: return: can only `return' from a function or sourced script", any idea?. I did issue command "cat build" below. any iddue with "return 1"?.
$ cat build
make clean
make
echo "gcc -shared -Wl,-soname,libRecei ver.so.1 -o libReceiver.so. 1.0 -L/opt/lib PC_Receiver.o"
gcc -shared -Wl,-soname,libRecei ver.so.1 -o libReceiver.so. 1.0 PC_Receiver.o
status=$?
if [ $status = 0 ] ; then
echo "mv libReceiver.so. 1.0 /opt/lib"
mv libReceiver.so. 1.0 /opt/lib
echo "ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so"
ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so
echo "ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so. 1"
ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so. 1
echo SUCCESS creating shared lib
else
echo ERROR creating shared lib
return 1
fi
$ cat build
make clean
make
echo "gcc -shared -Wl,-soname,libRecei ver.so.1 -o libReceiver.so. 1.0 -L/opt/lib PC_Receiver.o"
gcc -shared -Wl,-soname,libRecei ver.so.1 -o libReceiver.so. 1.0 PC_Receiver.o
status=$?
if [ $status = 0 ] ; then
echo "mv libReceiver.so. 1.0 /opt/lib"
mv libReceiver.so. 1.0 /opt/lib
echo "ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so"
ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so
echo "ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so. 1"
ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so. 1
echo SUCCESS creating shared lib
else
echo ERROR creating shared lib
return 1
fi
Comment