PDA

View Full Version : HELP ${var%/*}



MethodMan
03-28-2002, 06:11 PM
Hello

I have a list of a whole bunch of c files, and their directories
for ex.

C/program/test.cpp
C/program/test1.h
C/personal/math.h
C/personal/iterate.cpp

Now I would like to use ${var%/*} to remove the names of the files and the last /, but i dont know how. I need to do this, so I can use sort and uniq, which would result in

C/program
C/personal

as being the directories that contain cpp files

Thanks

starX
03-29-2002, 12:57 AM
the basename program grabs the filename off of a path. You might try useing that to get the name of the file, and then use some kind of string comparison program to get the value of the string minus the substring (the filename).

starX
www.axisoftime.com

MethodMan
03-29-2002, 09:35 AM
Thanks

But how would i I implenent it. Can you show me some code?


Thanks again