csh and echo

Andre Goree andre at drenet.net
Thu May 29 16:11:26 UTC 2014


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! :)

-- 
Andre Goree
-=-=-=-=-=-
Email     - andre at drenet.net
Website   - http://www.drenet.net
PGP key   - http://www.drenet.net/pubkey.txt
-=-=-=-=-=-


More information about the freebsd-questions mailing list