How can I separate the path and file elements in a bash loop like this?
for file in `find /my/path -name "*.ext"`
do
#(path,onlyfile) = separate_path_and_file $file
#dosomethingwith $onlyfile
done
|
|
|
You can't. But you can do them separately.
|
|||
|
|
|
I would suggest
for file in `find /my/path -name "*.ext"`
do
path="$(dirname $file)"
onlyfile="$(basename $file)"
# ...
done
|
|||
|
|