[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
 

SV: [PROGRAMMERING] String handling i bash - SOLVED



>> Hvis det er tilfældet kan man "bare" bruge basename:

>> $ basename  /mnt/backup/backups/amanda/2009-09-14_01-09-26
>> 2009-09-14_01-09-26

>> Men det er jo sikkert ikke tilfældet. Og du kender sikkert basename
>> kommandoen. Men i fald det nu var alligevel...

>Jo, det var tilfældet, og nej, jeg kendte ikke basename. :-)

Undlad at bruge basename da den skal starte en ny proces.
 
 
Hans forslag, newdir=${latest##*/}, er klart den bedste måde at håndtere det på.
 
 
 
Man kan også lave andre smarte ting med variabler.
 
F.eks. dette i et script:
 
Comment="Dette er en kommentar!"
echo "${Comment// /_}"
 
giver dette resultat: Dette_er_en_kommentar!
 
 
M.v.h.
 
Frank Larsen.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2009-10-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] *