LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-29-2015, 12:11 PM   #1
coproc
LQ Newbie
 
Registered: Nov 2013
Distribution: Debian 7 "Wheezy" / Rasbian
Posts: 13

Rep: Reputation: Disabled
Scripts to respond to prompts


I have searched and was unsuccessful in finding a quick command or example to use.

I'm looking to automate an update process using command line in Debian.
Normally I'd use apt-get update|upgrade|dist-upgrade .

If apt-get finds a package to update it queries a Y/n response.
My objective is to have a script determine if this prompt is there, and if so to respond with 'Y'.
If not then it should not enter a response.

I know I'll need to use an IF/ELSE function, but what I'm having difficulties locating is to read the output of apt-get .

I know there's books and sites available, but they are all long and sometimes difficult to read or understand. And maybe my keywords are the right ones to use, as I'm not able to pinpoint a solution.

Thanks for your assistance.
 
Old 03-29-2015, 12:16 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Quote:
Originally Posted by coproc View Post
If apt-get finds a package to update it queries a Y/n response. My objective is to have a script determine if this prompt is there, and if so to respond with 'Y'. If not then it should not enter a response.
So basically you're looking for the ginormously dangerous "just update everything and be done with it" option, as in 'man apt-get': -y, --yes or --assume-yes?..
 
Old 03-29-2015, 03:17 PM   #3
coproc
LQ Newbie
 
Registered: Nov 2013
Distribution: Debian 7 "Wheezy" / Rasbian
Posts: 13

Original Poster
Rep: Reputation: Disabled
Since you put it that way, then I guess yes.
And that would answer my post.

However, when I run the update on these, I usually always say Y anyways and haven't had any issues.

Thanks for that quick reply!
 
Old 03-29-2015, 04:17 PM   #4
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 812

Rep: Reputation: 216Reputation: 216Reputation: 216
Take a look at unattended-upgrade. It lets you configure which upgrades should be done automatically.

Note that some upgrades cannot be done automatically because you have to make decisions, e.g. whether or not to update configuration files etc...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Donít Script Your Password! Add Simple Prompts to Shell Scripts LXer Syndicated Linux News 0 03-09-2013 10:51 PM
(Samba 3.0.20) Vista prompts for username, XP prompts just for password Noffie Linux - Server 2 07-21-2008 11:26 AM
Shell Scripts Answering Prompts dudeman41465 Linux - Software 1 01-24-2006 12:20 PM
boot up connfirmation prompts phil_anderer Linux - Newbie 2 02-12-2004 08:46 AM
RH9/Question about prompts in X. yukaputzer Linux - Newbie 1 12-16-2003 09:13 PM


All times are GMT -5. The time now is 12:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration