Вопрос, который я знаю, очень запутанный, и для меня это немного гобстоп!
Я пытаюсь отобразить код скрипта bash на странице Facelets, чтобы пользователь мог скопировать код скрипта из браузера.Этот код помещен в элемент code
, как показано ниже.Но запрос страницы дает мне ошибку, связанную с тем, что я считаю причиной (выделено жирным шрифтом).Я попытался заменить символы {
, }
, & -
на html-замены, и все еще получаю ошибки.Возможно, это не разрешено?</p>
<p>#!/bin/bash<br/>
#Author: Yucca Nel <a href="http://thejarbar.org" rel="nofollow">http://thejarbar.org</a><br/>
#Will restart system<br/>
#Modify these variables as needed...<br/>
tempWork=/tmp/work<br/>
defaultStartScript=/etc/init.d/rc.local<br/>
defaultMaven=3.0.4<br/>
locBin=/usr/local/bin<br/>
mavenUsrLib=/usr/lib/maven<br/>
<br/>
sudo mkdir -p $mavenUsrLib<br/>
mkdir -p $HOME/.m2<br/>
<br/>
read -p "Please [Enter] full path name of your local startup script ($defaultStartScript is the default). Please<br/>
make sure on this before providing a value by consulting documentation for your system:" locStartScript<br/>
<strong>locStartScript=${locStartScript:-$defaultStartScript}</strong><br/>
<br/>
read -p "Please [Enter] Maven Version ($defaultMaven is default):" mavenVersion<br/>
<strong>mavenVersion=${mavenVersion:-$defaultMaven}</strong><br/>
<br/>
<br/>
if [ ! -f $locStartScript ]<br/>
then<br/>
echo "The file you provided could not be found. Remember to include the full path and try again. Exiting in 7 secs..."<br/>
sleep 7<br/>
exit 1<br/>
fi<br/>
<br/>
mkdir -p /$tempWork<br/>
cd /$tempWork<br/>
<br/>
wget <a href="http://mirrors.powertech.no/www.apache.org/dist//maven/binaries/apache-maven-" rel="nofollow">http://mirrors.powertech.no/www.apache.org/dist//maven/binaries/apache-maven-</a>$mavenVersion-bin.tar.gz<br/>
tar -zxvf ./<em><br/>
<br/>
#Move it to a more logical location<br/>
sudo mv -f ./apache-maven-$mavenVersion $mavenUsrLib/<br/>
<br/>
#If you have Maven on Windows and use VirtualBox, you can set up the maven to be a virtualbox shared folder.<br/>
#The name must match the name used below (ignore if irrelevant to you).<br/>
<br/>
<br/>
if [ -f /sbin/mount.vboxsf ]<br/>
then<br/>
sudo /sbin/umount $HOME/.m2<br/>
sudo /sbin/umount $mavenUsrLib<br/>
sudo /sbin/mount.vboxsf .m2 $HOME/.m2<br/>
sudo /sbin/mount.vboxsf maven $mavenUsrLib<br/>
fi<br/>
<br/>
if mountpoint -q $HOME/.m2 && mountpoint -q $mavenUsrLib<br/>
then<br/>
#Add it to the start script to automate process...<br/>
if ! grep "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" $locStartScript<br/>
then<br/>
echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" | sudo tee -a $locStartScript<br/>
fi<br/>
<br/>
if ! grep "sudo /sbin/mount.vboxsf maven $mavenUsrLib" $locStartScript<br/>
then<br/>
echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" | sudo tee -a $locStartScript<br/>
fi<br/>
echo "exit 0" | sudo tee -a $locStartScript<br/>
sudo chmod +x $locStartScript<br/>
<br/>
#Create a mount and unmount script file...<br/>
rm -rf $tempWork/</em><br/>
echo '#!/bin/bash' > $tempWork/maven-mount.sh<br/>
echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" >> $tempWork/maven-mount.sh<br/>
echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" >> $tempWork/maven-mount.sh<br/>
echo "echo 'mounted maven'" >> $tempWork/maven-mount.sh<br/>
echo "exit 0" >> $tempWork/maven-mount.sh<br/>
<br/>
echo '#!/bin/bash' > $tempWork/maven-umount.sh<br/>
echo "sudo umount $HOME/.m2" >> $tempWork/netbeans-umount.sh<br/>
echo "sudo umount $mavenUsrLib" >> $tempWork/netbeans-umount.sh<br/>
echo "echo 'unmounted maven'" >> $tempWork/maven-mount.sh<br/>
echo 'exit 0' >> $tempWork/maven-umount.sh<br/>
<br/>
#Script for mounting ALL VirtualBox shared solders....<br/>
#If there isn't one create one...<br/>
if [ ! -f $locBin/mount-all-from-host.sh ]<br/>
then<br/>
echo '#!/bin/bash' > $tempWork/mount-all-from-host.sh<br/>
echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" | sudo tee -a $tempWork/mount-all-from-host.sh<br/>
echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" | sudo tee -a $tempWork/mount-all-from-host.sh<br/>
echo "exit 0" | sudo tee -a $tempWork/mount-all-from-host.sh<br/>
<br/>
#Otherwise if there is one, but no mount, add one...<br/>
elif ! grep "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" $locBin/mount-all-from-host.sh<br/>
then<br/>
sudo sed -ie '$d' $locBin/mount-all-from-host.sh<br/>
echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" | sudo tee -a $locBin/mount-all-from-host.sh<br/>
echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh<br/>
<br/>
elif ! grep "sudo /sbin/mount.vboxsf maven $mavenUsrLib" $locBin/mount-all-from-host.sh<br/>
then<br/>
sudo sed -ie '$d' $locBin/mount-all-from-host.sh<br/>
echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" | sudo tee -a $locBin/mount-all-from-host.sh<br/>
echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh<br/>
<br/>
fi<br/>
<br/>
#Script for unmounting ALL VirtualBox shared folders...<br/>
#If there isn't one create one...<br/>
if [ ! -f $locBin/umount-all-from-host.sh ]<br/>
then<br/>
echo '#!/bin/bash' > $tempWork/umount-all-from-host.sh<br/>
echo "sudo umount -a -t vboxsf" | sudo tee -a $tempWork/umount-all-from-host.sh<br/>
echo "echo 'unmounted all VirtualBox shared folders'" | sudo tee -a $tempWork/umount-all-from-host.sh<br/>
echo "exit 0" | sudo tee -a $tempWork/umount-all-from-host.sh<br/>
fi<br/>
<br/>
sudo chmod +x $tempWork/<em><br/>
sudo mv -f $tempWork/</em>.sh $locBin/<br/>
rm -rf $tempWork<br/>
fi<br/>
<br/>
sudo ln -f -s $mavenUsrLib/apache-maven-$mavenVersion/bin/* /usr/bin/<br/>
sudo rm -rf $tempWork<br/>
sudo /sbin/reboot<br/>
<br/>
exit 0<br/>