[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

how to apply 'make' functions to for-loop index



Is it possible to apply 'make' functions such as $(dir ...), $(suffix
...), $(basename ...), $(filter ...), etc., to the index of a bash
for-loop, to enable operations such as:

    directories := red green yellow
        
        (for d in $(directories:/=);    
            do    
                (for f in *;    
                    do    
                        cp $(nodir $$f) $$d;    
                    done;)    
            done;)
    
within the context of a makefile?

What I am trying to do is sort files into several groups by moving
them from a directory "pool":

    pool/red-17
    pool/red-23
    pool/red-28
    pool/...
    pool/green-20
    pool/green-33
    pool/...
    pool/yellow-5
    pool/yellow-22
    pool/...

into the respective subdirectories:

    pool/red/red-17
    pool/red/red-23
    pool/red/red-28
    pool/red/...

    pool/green/green-20
    pool/green/green-33
    pool/green/...

    pool/yellow/yellow-5
    pool/yellow/yellow-22
    pool/yellow/...

RLH



Reply to: