[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: [PROGRAMMERING] String handling i bash



Hej Jens,

Ser dine variabler altid sådan ud?
Altså vil der altid kun være et ekstra niveau?

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...

mvh
Folmer


2009/9/16 Jens Bang <sslug@sslug>:
> Jeg har et bash script hvor jeg skal have delt en streng, baseret på indholdet
> af en anden streng.
>
> Jeg har en variabel ($latest) der indeholder denne streng:
>    /mnt/backup/backups/amanda/2009-09-14_01-09-26
>
> Og en anden variabel ($root) der indeholder denne streng:
>    /mnt/backup/backups/amanda/
>
> Jeg vil nu have det 'overskydende' i $latest tildelt en tredie variabel
> ($newdir), dvs. denne streng:
>    2009-09-14_01-09-26
>
> Hvordan gør man det?
>
> --
>
>        |\     _,,,---,,_       Greetings, Jens
>  ZZZzz /,`.-'`'    -.  ;-;;,_
>      |,4-  ) )-,_. ,\ (  `'-' sslug@sslug
>     '---''(_/--'  `-'\_)
> ----------------------------------------------------
> 'Press to test' ... <Click> ... 'Release to detonate'
>
>


 
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] *