こんにちは私はperlを使用して答えに記載されているようにこれを行おうとしていますが、機能していません。
#!/usr/bin/perl -w
$pipe="data";
$username="mukesh";
$password="mukesh";
open my $pipe, '|chpasswd' or die "can't open pipe: $!";
print {$pipe} "$username:$password";
close $pipe
[root@testgfs2 user_mgmt]# ./tess3.sh
Name "main::pipe" used only once: possible typo at ./tess3.sh line 2.
chpasswd: line 1: line too long
chpasswd: error detected, changes ignored
どんな体も提案できます。
--stdinはすべての*nixで使用できるわけではないので、これを使用しようとしています
編集:これを行うためのCのプログラムはありますか?* nixesの場合、すべてのバージョンに役立つ可能性があります