I have done a script, but it is based on shell script, and i want to convert it to perl. I am very new to perl.
This is my shell script
#!/bin/bash
echo -n "Enter your name : "
read username
echo -n "Enter your password : "
read password
pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
useradd -m -p $pass $username
And i want to change it to perl script
This is how i change it, but it does not work
#!/usr/bin/perl
print "Enter your name : \n";
$username = <STDIN>;
print "Enter your password : \n";
$password = <STDIN>;
$pass=$('print crypt($ARGV[0], "password")' $password)
system("useradd -m -p $pass $username");
PLease help me.
|
Light Poster
|
|
| 22Feb2008,11:53 | #2 |
|
I have found the solution.Thanks
#!/usr/bin/perl print "Enter your name : \n"; $username = <STDIN>; print "Enter your password : \n"; chomp(my $password = <STDIN>); $pass = crypt($password,"password"); system("useradd -m -p $pass $username"); |
|
Team Leader
|
![]() |
| 22Feb2008,13:44 | #3 |
|
Good that you have found the solution yourself! Happy coding in Perl!
|

