Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 May 2014 18:26:29 +0200
From:      "Michael Ross" <gmx@ross.cx>
To:        "FreeBSD Questions" <freebsd-questions@freebsd.org>, "Andre Goree" <andre@drenet.net>
Subject:   Re: csh and echo
Message-ID:  <op.xgmqmfy5g7njmm@michael-think>
In-Reply-To: <6afd2e37bfc1736513878d896c5c8314@drenet.net>
References:  <6afd2e37bfc1736513878d896c5c8314@drenet.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 May 2014 18:02:35 +0200, Andre Goree <andre@drenet.net> 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.  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"
>
> [root@fbsdtest13 ~]# echo "\$1\$rVxldcGZ\$CisrIAX4SBYUkMJt9KjXl0"
> $1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0
> [root@fbsdtest13 ~]# exit
> root@fbsdtest13:~ # echo "\$1\$rVxldcGZ\$CisrIAX4SBYUkMJt9KjXl0"
> rVxldcGZ: Undefined variable.
>
> Any insight would be greatly appreciated! :)
>

Try with single quotes:

# echo '$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0'
$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0


( Sorry for the damaged 2nd mail, in case it got through )

Michael



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.xgmqmfy5g7njmm>