[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

RE: [TEKNIK] Cron Job, der automatisk tilføj er subdomains ala "test.bruger.juac.dk"



> -----Original Message-----
> From: Jon Bendtsen [mailto:sslug@sslug 
> Sent: 11. april 2011 12:49
> To: sslug@sslug
> Subject: Re: [TEKNIK] Cron Job, der automatisk tilføjer 
> subdomains ala "test.bruger.juac.dk" 
> 
> On 11/04/2011, at 16.41, Thomas Rosendal Jensen wrote:
> 
> > Er der nogen der kan komme med koden til at adskille "~" og 
> resten af navnet fra hinanden,sådan at man kan slette fil 
> poster indeholdende navnet efter "~". Desuden vil jeg meget 
> gerne have noget kode til at kunne slette en linie 
> fra/etc/hosts der indeholder en bestemt streng.
> 
> cut -d "~" -f1 samt cut -d "~" -f2
> 
> Advarsel, kan give problemer hvis flere opdaterer /etc/hosts, 
> da adgangen ikke er atomisk
> 	grep -v "farlig streng" /etc/hosts > /etc/hosts
> 
> 
> 


Lidt nemmere end cut.

Script:

VAR1="~filnavn"
echo Var1: $VAR1

VAR2="${VAR1#~*}"
echo Var2: $VAR2


Resultat:
Var1: ~filnavn
Var2: filnavn


" er nødvendig da ~ ellers bliver expanderet til afviklerens HOME hvis der er / efter ~


Du skal under alle omstændigheder have styr på hvilken mappe du sletter filen fra.



Med venlig hilsen / Regards

Frank Larsen
Kimik IT A/S
PO Box 740
3900 Nuuk
Greenland
Mail : sslug@sslug
Phone: +299 34 20 00 



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-05-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *