I apologize if this question is too basic, but I'm really very very new to perl. Now I want to write the following two lines of code in one line:
perl -e 'print crypt("my_password","\$6\$my_salt\$")' perl -pe 's|(root):(\$.*?:)|\1:my_encrypted_password:|' /etc/shadow
Basically I want to replace the
my_encrypted_password with what's being printed from the first line. But I have no idea how to write it correctly? Any help will be greatly appreciated.