[ale] SHELL: get file name

Geoffrey esoteric at 3times25.net
Tue Jul 2 13:47:38 EDT 2002




Michael Kachline wrote:
>>Zyman, Andy wrote
>>
>>>Hello,
>>>Some time ago i had the question "how to get dirname". Now i decided to go
>>>even further :) and get filename.
>>>So here we go:
>>>ABSFILE=/home/aaa/bbb/ddd/name.log
>>>
>>echo ${ABSFILE##*/}
>>
> 
> 	FILENAME="echo $fullfile  | `basename`"

Again, using the binary /bin/basename is much slower.  echo the var 
piped to basename doesn't make sense either, it invokes more overhead 
because of the pipe.  basename takes a filename or var as argument, so 
there's no need in the pipe.  The above builtin is much faster and cleaner.

> 
> 
> 				- Mike
> --------------------------------------------------------------------
>  Michael Kachline
>  Systems Programmer
> 
>  Intec Telecom Systems
>  Building G, 4th Floor                      
>  5775 Peachtree-Dunwoody Road            
>  Atlanta, GA  30342
> --------------------------------------------------------------------
> 
> 
> 


-- 
Until later: Geoffrey		esoteric at 3times25.net

I didn't have to buy my radio from a specific company to listen
to FM, why doesn't that apply to the Internet (anymore...)?


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list