Pregunta

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
¿Fue útil?

Solución

You can read user input with the read command.

dialog --tailbox /etc/passwd 200 200
read -p "select user: " username
chfn "$username"
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top