Results 1 to 3 of 3
How do i write this bash script that changes file extension from .abc to .def in csh:
> $ ls
> test1.abc test2.abc test3.abc test4.abc
>
>
> $ for ...
- 06-09-2009 #1Just Joined!
- Join Date
- Jul 2007
- Location
- San Francisco, CA
- Posts
- 7
file extension renaming (bash to csh)?
How do i write this bash script that changes file extension from .abc to .def in csh:
> $ ls
> test1.abc test2.abc test3.abc test4.abc
>
>
> $ for i in *.abc; do
> > mv "$i" "${i%.abc}.def" ;
> > done
>
> $ ls
> test1.def test2.def test3.def test4.def
- 06-09-2009 #2Just Joined!
- Join Date
- Jul 2007
- Location
- San Francisco, CA
- Posts
- 7
>ls
test1.abc test2.abc test3.abc
>foreach n ( `ls *.abc` )
foreach? set base = `basename $n .abc`
foreach? mv $n $base.def
foreach? end
>ls
test1.def test2.def test3.def
>echo $shell
/bin/csh
- 06-09-2009 #3Just Joined!
- Join Date
- Jul 2007
- Location
- San Francisco, CA
- Posts
- 7
there's also a built in csh command "rename"!
>ls
test1.abc test2.abc test3.abc
>rename abc def *.abc
>ls
test1.def test2.def test3.def


Reply With Quote