OT: Shell script

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Mon Jul 11 19:34:03 GMT 2005


Philip Hallstrom <freebsd at philip.pjkh.com> writes:

> >> I am trying to write an SH script that i need some functionality.
> >>
> >> I want it to be able to get a filename without the extention on the end.
> >>
> >> for example.
> >>
> >> file.mp3
> >>
> >> i would like it to return 'file'.
> >
> > basename(1); it's even POSIX, so it's pretty portable.
> 
> But only if he knows the file extension before hand...

Hmm.  Good point.  
Looking into my existing scripts, I seem to use ${fil%.*}



More information about the freebsd-questions mailing list