sslug-teknik team mailing list archive
-
sslug-teknik team
-
Mailing list archive
-
Message #101441
Re: BASH: vil ikke sammenkæde strenge
On 12/03/2011, at 19.27, Jon Bendtsen wrote:
> On 12/03/2011, at 19.26, Thomas Rosendal Jensen wrote:
>
>> Sådan noget rod!
>> Kan det laves i et andet sprog?
>> Er det muligt at realisere i PHP?
>
> Du kan stort set kode hvad som helst i et vilkårligt sprog hvis du virkelig vil. Nogle sprog er dog bedre til nogle ting end andre ting.
>
> Shell scripts er ikke dårligt, du har bare en fejl et eller andet sted, prøv at finde den. Skriv din IF sætning på en anden måde
[kliiiiiiip]
>>>>> echo '18'
>>>>> if [ ! -d ${DIR} ] ;
>>>>> then
>>>>> echo '19'
>>>>> mkdir ${HOME}/PUBLIC_HTML
>>>>> fi
output som du har sendt siger at 18 bliver echoet, men 19 osv gør ikke, så må der jo være en fejl lige efter 18.
Du bruger if med et ! foran for at lave en not? eller hvad var din intention?
JonB
>>>> 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