From owner-freebsd-questions@FreeBSD.ORG Sun Jan 15 11:12:57 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4834C16A41F for ; Sun, 15 Jan 2006 11:12:57 +0000 (GMT) (envelope-from nospam@mgedv.net) Received: from mgedv.at (mail.mgedv.at [195.3.87.103]) by mx1.FreeBSD.org (Postfix) with ESMTP id D9FBE43D46 for ; Sun, 15 Jan 2006 11:12:56 +0000 (GMT) (envelope-from nospam@mgedv.net) Received: from metis (localhost [127.0.0.1]) by mgedv.at (SMTPServer) with ESMTP id 6EAAC186802; Sun, 15 Jan 2006 12:12:54 +0100 (MET) From: "mdff" To: Date: Sun, 15 Jan 2006 12:12:56 +0100 Message-ID: <007101c619c4$a3585f40$0a86a8c0@avalon.lan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <43C9FB5A.2050506@yahoo.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Thread-Index: AcYZpmxdQw0QA6SoQVGNIZQ2xIwvkAAHY+sg Cc: 'Ronny Hippler' Subject: RE: shell scripts and escaped charecters in file names X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: nospam@mgedv.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jan 2006 11:12:57 -0000 > > Hello, > I am trying to get the following script to run with no success. > - ------------------------------------ > #!/bin/csh > foreach file (\*vol\*) > mv $file `basename $file .par2`.PAR2 > echo $file > end > - ------------------------------------ > and get the following error: > usage: mv [-f | -i | -n] [-v] source target > ~ mv [-f | -i | -n] [-v] source ... directory > > I know it is because of the spaces and such in the file names. I have > tried quoting single double and also escaping them but all fails. what > is the magic? Please cc me off list. thanks! > try the following: ls -1|grep '\.par2$'|while read s_line do mv -i "./$s_line" "./`basename $s_line .par2`.PAR2" done; the "./" stuff is for files starting with "-"; br...