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/shadowBasically 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.
String concatenate in perl?
perl
You probably mean something like this:perl -pe 's|(?<=root:)[^:]*|crypt(my_password,\$6\$my_salt\$)|e' /etc/shadowFrom perldoc perlre:    Substitution-specific modifiers described in    s/PATTERN/REPLACEMENT/msixpodualngcer in perlop are:      e  - evaluate the right-hand side as an expressionOn the right side you can use $& to refer to the matching part and $1 for the first captured part and so on.