← Back to team overview

sslug-teknik team mailing list archive

Re: BASH: vil ikke sammenkæde strenge

 

Kører nu med "#!/bin/bash"

Med samme resultat.

Thomas

Jon Bendtsen wrote:
On 12/03/2011, at 18.01, Thomas Rosendal Jensen wrote:

min redigerede kode er følgende

#¡/bin/bash4

hvorfor kører du bash4? og hvad er det? min hedder bare bash

echo '1'
USRNME=`whoami`
echo '2'
DOT='.'
echo '3'
MNDOMN='testwebsite.dk'
echo '4'
USRDOMN=${1}
echo '5'
LNK=""


LNK=$(echo ${USRDOMN}${DOT}${USRNME}${DOT}${MNDOMN})
echo '6'
#IP="90${DOT}184${DOT}106${DOT}85"
echo '7'
DIR=${HOME}/PUBLIC_HTML
echo '8'
EMAIL=${2}
echo '9'
echo '$1=' ${1}
echo '10'
echo '$2=' ${2}
echo '11'
echo '$dot=' ${DOT}
echo '12'
echo '$usrnme=' ${USRNME}
echo '13'
echo '$MNDOMN=' ${MNDOMN}
echo '14'
echo '$USRDOMN=' ${USRDOMN}
echo '15'
echo '$LNK=' ${LNK}
echo '16'
echo '$ip= ' ${IP}
echo '17'
echo '$dir=' ${DIR}
echo '18'
if [ ! -d ${DIR} ] ;
then
	echo '19'
	mkdir ${HOME}/PUBLIC_HTML
fi

bliver den der if regnet korrekt ud? Prøv at skrive den om til en anden måde



JonB

echo '20'
mkdir "${HOME}/PUBLIC_HTML/${LNK}"
echo '21'
mkdir "/usr/lib/cgi-bin/${LNK}"
echo '22'
echo "<VirtualHost *:80>
ServerAdmin ${EMAIL}
ServerName www.${LNK}
ServerAlias ${LNK}
DocumentRoot ${DIR}/${LNK}
 # Set Document Root directory options
 <Directory />
   Options FollowSymlnks -Indexes Includes
   # Allow use of .htaccess file
   AllowOverride Limit FileInfo
 </Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/${LNK}
 # Set CGI-BIN directory options
 <Directory /cgi-bin>
   AllowOverride None
   Options +ExecCGI -Multiviews +SymlnksIfOwnerMatch
   Order allow,deny
   Allow from all
 </Directory>
CustomLog /var/log/apache2/access.log common
ErrorLog /var/log/apache2/error.log
</VirtualHost>
" > /etc/apache2/sites-available/${LNK}
echo '23'
a2ensite ${LNK}
echo '24'
echo '${IP}        www.${LNK}       ${LNK}' >> /etc/hosts
echo '25'
exec /etc/init.d/apache2 restart
echo '26'
quit


Og den giver resultatet:
juac:/home/tj# ./addwebsite test test@xxxxxxx
1
2
3
4
5
: command not found11:
6
7
8
9
$1= test
10
$2= test@xxxxxxx
11
$dot= .
12
$usrnme= root
13
$MNDOMN= testwebsite.dk
14
$USRDOMN= test
15
estwebsite.dk
16
$ip=
17
$dir= /root/PUBLIC_HTML
18
./addwebsite: line 79: syntax error: unexpected end of file
juac:/home/tj#




Hjælp ønskes

Thomas







Follow ups

References