On Dec 30, 2012, at 9:54 PM, William Ehrich <[email protected]> wrote:

> I'm trying to write a shell script (in a tcsh) which uses a filename argument 
> without its extension:
> 
>  filename=$1:r
>  echo filename
> 
> doesn't work. What is the right way to do it?

Not sure about tcsh, but this will do it in bash:

$ filename='foo.txt'
$ echo $filename | sed s/\\..*$//
foo

If you need foo.bar.txt to to return foo.bar you'll need something a bit 
stronger...

./s

_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk

Reply via email to