From owner-freebsd-questions@FreeBSD.ORG Thu May 29 16:39:51 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7941EEAB for ; Thu, 29 May 2014 16:39:51 +0000 (UTC) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E17B2CC4 for ; Thu, 29 May 2014 16:39:51 +0000 (UTC) Received: from r56.edvax.de (port-92-195-4-63.dynamic.qsc.de [92.195.4.63]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 3C7E6276C7; Thu, 29 May 2014 18:39:42 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id s4TGdgbv002937; Thu, 29 May 2014 18:39:42 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Thu, 29 May 2014 18:39:42 +0200 From: Polytropon To: Andre Goree Subject: Re: csh and echo Message-Id: <20140529183942.7119a5e6.freebsd@edvax.de> In-Reply-To: <6afd2e37bfc1736513878d896c5c8314@drenet.net> References: <6afd2e37bfc1736513878d896c5c8314@drenet.net> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2014 16:39:51 -0000 On Thu, 29 May 2014 12:02:35 -0400, Andre Goree wrote: > I'm writing a script within which I need to have encrypted passwords > passed to 'pw mod user'. My issue is that csh does not seem to escape > the the "$" correctly and thus I receive an "Undefined variable" error > message. The csh does exactly what it should to. Use '...' instead of "..." to avoid evaluations within a string, for example: % echo '$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0' $1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0 > Bash does not seem to have this same issue: > > root@fbsdtest13:~ # echo "$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0" > rVxldcGZ: Undefined variable. > root@fbsdtest13:~ # bash > [root@fbsdtest13 ~]# echo "$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0" It's not an issue, it's intended. Strings enclosed in "..." are allowed to contain variables, whereas strings enclosed in '...' are being processed without expansion. $ echo '$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0' $1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0 I'm sure this is mentioned somewhere in "man bash", as well as in "man csh" regarding the C Shell. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...