If I want to clip the leading directory off a bunch of source files in bash, 
it's not too hard:

for i in src/*.cpp; do echo ${i/src\//}; done
or:
for i in src/*.cpp; do echo ${i:4:}; done
or:
for i in src/*.cpp; do echo ${i#src/*}; done

and if I want to change the .cpp to .o I can do something like:

for i in src/*.cpp; do echo ${i/.cpp/.o}; done

and there's other ways for that, too.  But how can I do both in the same 
expansion expression?

I would have thought that something would work like:

for i in src/*.cpp; do echo ${{i#src/*}/.cpp/.o}; done

but that doesn't, and neither does anything else I tried.  The docs are silent 
on the subject of multiple expansional operations.

Thanks,

 -James Nickerson

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to