1

Is there any bash command or technique through which we can enter in password alongwith the command which requires the password of superuser? for e.g

sudo apt-get install kde <password>

I am actually using it to pass it in a c program which takes in bash command and prints out the output.

MKJ
  • 1,569

1 Answers1

1

I sorted it out finally

echo <mypassword> | sudo -S apt-get install <package name>
MKJ
  • 1,569
  • In general it is not recommended to work this way. Your password will be visible in your shell history and also in the proc filesystem. Other users might read it out. – qbi Feb 24 '13 at 15:15