質問

Hi i am writing program which should change /etc/passwd file using chfn from file. Is it possible to run a file with bash file.txt with the command chfn there but for different user without editing file.txt. It should somehow let me to write user i want to edit name.

dialog --tailbox /etc/passwd 200 200
echo select user
chfn what should i do here
役に立ちましたか?

解決

You can read user input with the read command.

dialog --tailbox /etc/passwd 200 200
read -p "select user: " username
chfn "$username"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top