Unix Programming - foreach

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2006 > foreach





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author foreach
Mehlwurm

2006-06-08, 7:26 am

hi,

i have some trouble getting a loop started

foreach i (`cat liste.txt`)
rm $i
end

foreach: No Match.

what am i doing wrong?
liste.txt is a file which contains filenames in the directory .. all
rights are set, but it doesn=B4t work

Mehlwurm

2006-06-08, 7:26 am

i am so sorry

it was my fault

the first line in liste.txt was empty ...

SORRY

Maurizio Loreti

2006-06-08, 7:26 am

"Mehlwurm" <mehlwurm@rocketmail.com> writes:

> hi,
>
> i have some trouble getting a loop started
>
> foreach i (`cat liste.txt`)
> rm $i
> end
>
> foreach: No Match.
>
> what am i doing wrong?


what tells "echo $SHELL" ? maybe /bin/bash ?

--
Maurizio Loreti http://www.pd.infn.it/~loreti/mlo.html
Dept. of Physics, Univ. of Padova, Italy ROT13: ybergv@cq.vasa.vg
Ralf Fassel

2006-06-08, 7:26 am

* "Mehlwurm" <mehlwurm@rocketmail.com>
| the first line in liste.txt was empty ...

If you have 'sane' filenames in liste.txt you could also simply go

rm -f `cat liste.txt`

R'
Mehlwurm

2006-06-09, 7:24 am

@Ralf
THX :-)

@ Mairizio
I am using the csh
and there is no other one installed ;-)

Ralf Fassel

2006-06-09, 7:24 am

* "Mehlwurm" <mehlwurm@rocketmail.com>
| I am using the csh
| and there is no other one installed ;-)

A Unix with no /bin/sh, or /bin/ksh?
Strange that it works at all...

R'
Chris F.A. Johnson

2006-06-09, 7:23 pm

On 2006-06-09, Mehlwurm wrote:
> @Ralf
> THX :-)
>
> @ Mairizio
> I am using the csh
> and there is no other one installed ;-)


There is no modern Unix system without /bin/sh (except perhaps some
minimal or embeded installations). Most wouldn't run without it.

What are you using?


--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
Mehlwurm

2006-06-12, 1:30 am

Chris F.A. Johnson schrieb:

>
> What are you using?
>=20
>=20


a true64 with a sh but linked to csh .. it wasn=B4t my idea ;-)

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com