csh and echo

Michael Ross gmx at ross.cx
Thu May 29 16:26:46 UTC 2014


On Thu, 29 May 2014 18:02:35 +0200, Andre Goree <andre at 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 at fbsdtest13:~ # echo "$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0"
> rVxldcGZ: Undefined variable.
> root at fbsdtest13:~ # bash
> [root at fbsdtest13 ~]# echo "$1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0"
>
> [root at fbsdtest13 ~]# echo "\$1\$rVxldcGZ\$CisrIAX4SBYUkMJt9KjXl0"
> $1$rVxldcGZ$CisrIAX4SBYUkMJt9KjXl0
> [root at fbsdtest13 ~]# exit
> root at 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


More information about the freebsd-questions mailing list