Reputation: 3838
I'm a bit of a noob with Perl, and can't to see what's wrong with this script:
#!/bin/sh
randAnPass=true;
if [ $randAnPass = true ]
then
pass=perl /root/bin/randpass
else
# prompt for setting user's password ..
echo -n "pick password for '${user}': "
read pass
fi
#echo $randAnPass;
echo "Generated pass = $pass";
For some reason it outputs:
r4Nd0mP
Generated pass =
I want it to output
Generated pass = r4Nd0mP
Upvotes: 1
Views: 3762
Reputation: 57650
If you want to just capture STDOUT of perl command use,
pass=$(perl /root/bin/randpass)
But if you need to capture both STDERR and STDOUT,
pass=$(perl /root/bin/randpass 2>&1)
Upvotes: 5