Hello
I have a list of a whole bunch of cpp files, and their directories
for ex.
home/program/test.cpp
home/program/test1.h
home/personal/math.h
home/personal/iterate.cpp
Now I want to use ${varname%/*} to remove the names of the files and the last /, but i dont know how to use it. What should I put in carname?
x=$1
while [ "$2" ]
do
find $x -name "*.$2"
shift
done
the results should be like this
C/program/
C/personal/
as being the directories that contain cpp files
Thanks
I read file names off the command line, using $1, $2, I have the path saved in a variable called x
x=$1
in my loop i use find, and it prints the first list of directories
THanks for the hlep