Do you want to continue linux

«Do you want to continue[Y/n]?» Why the upper case?

I am new to Ubuntu and some little thing started bugging me. When I try to install a program, Ubuntu asks:

Do you want to continue[Y/n]? 

What is bugging me is why the letter Y is upper case and n is lower case. Whatever case I enter it doesn’t change the outcome: it either continues or not. Do they have any significant reason why one is upper and the latter is lower? Are they trying to notify us that we can enter both and it won’t change anything?

2 Answers 2

Usually, the uppercase option ( Y in your case) is the default option if you don’t provide any and just press ↲ Enter . This is a convention I see very often on the command line.

I wish I could provide a credible source, but I fail to find one. However, this is something I see very often in Debian/Ubuntu systems, in various programs.

The closest «source» I could find is a Q&A on Stack Overflow: Standard format for yes/no questions in the terminal?

@rebuked I’m afraid this is a choice made by a developer and unless he provides a way to configure this, you will not be able to change this.

Many Unix/Linux terminal programs do not support even bold or colored text and so conventions like this are used to distinguish the default value if you just pressed ENTER without any text (because it’s faster).

Most (well written) programs will accept either upper or lowercase responses (i.e. ‘Y’,’y’,’N’, or ‘n’).

A lot of these programs are shell scripts so changing the default for a prompt like this is usually not difficult.

Through some interfaces, terminal programs still do not support color/bold. Sometimes it is correct not to support them. For example, if the user redirects the output of a program to a text file, should that file contain escape characters specifying color codes when the program is run? (The matter is further complicated when a program must be compatible with systems that don’t use Unix-style escape codes for color formatting. Some systems, like Windows, have no such escape codes, so color data would be lost in redirection.) Thus, this is applicable beyond tradition and backward compatibility.

Читайте также:  Running linux на русском

Источник

How to force apt to give you a «Do you want to continue? [Y/n]» for every install

If that package will install additional packages. But how do I force apt to give me that confirmation dialog every time that I install a package no matter whether or not it will install additional packages as well? OS Information:

Description: Ubuntu 14.10 Release: 14.10 
apt: Installed: 1.0.9.2ubuntu2 Candidate: 1.0.9.2ubuntu2 Version table: *** 1.0.9.2ubuntu2 0 500 http://gb.archive.ubuntu.com/ubuntu/ utopic/main amd64 Packages 100 /var/lib/dpkg/status 

1 Answer 1

A simple solution would be to make a script that checks first and then launches. For example:

#!/usr/bin/env bash ## Do a test run of the apt-get command, printing the relevant details sudo apt-get -s install "$@" | perl -ne '$a=1 if /Reading state information/; if($a==1 && /:$/ || /^\s/)' read -p "Do you want to continue? [YN] " response [[ $response =~ ^[Yy] ]] && sudo apt-get install "$@" 

If you save that script somewhere in your path, for example as ~/bin/apt-nanny and make it executable ( chmod +x ~/bin/apt-nanny ), you can use it to install packages (using nedit as an example):

$ apt-nanny nedit The following packages were automatically installed and are no longer required: liblightdm-gobject-1-0 lightdm-gtk-greeter The following extra packages will be installed: libmotif-common libmrm4 libuil4 libxm4 The following NEW packages will be installed: libmotif-common libmrm4 libuil4 libxm4 nedit Do you want to continue? [YN] 

If you enter y or Y , the script will continue and install the packages.

  • The script will show you the same information twice in cases where you would have been asked for confirmation anyway.
  • I haven’t tested this extensively, there may be cases whjere more/less information than you need will be shown.
  • It’s ugly and runs apt-get twice.

Источник

Why does apt-get abort by itself, as though I’d pressed ‘N’?

Do you want to continue? [Y/n] Abort. 

I didn’t type anything, it just automatically aborts. Can you guys help me? =======[ Edit #1 Aug 12 ]======= Here I have copied the entire terminal texts. I have run 2 command here, the: sudo apt-get update and then after I get the result I run the sudo apt-get upgrade Here’s the copied texts from terminal:

franzbiely@Franz-Gizmo:~$ sudo apt-get update Ign http://archive.ubuntu.com trusty InRelease Ign http://ppa.launchpad.net trusty InRelease Ign http://archive.canonical.com trusty InRelease Ign http://extras.ubuntu.com trusty InRelease Ign http://archive.ubuntu.com trusty-updates InRelease Ign http://ppa.launchpad.net trusty InRelease Hit http://archive.canonical.com trusty Release.gpg Hit http://extras.ubuntu.com trusty Release.gpg Ign http://archive.ubuntu.com trusty-backports InRelease Ign http://ppa.launchpad.net trusty InRelease Hit http://archive.canonical.com trusty Release Hit http://extras.ubuntu.com trusty Release Hit http://archive.canonical.com trusty/partner Sources Hit http://extras.ubuntu.com trusty/main Sources Hit http://ppa.launchpad.net trusty Release.gpg Ign http://dl.google.com stable InRelease Hit http://ppa.launchpad.net trusty Release.gpg Hit http://archive.canonical.com trusty/partner amd64 Packages Hit http://dl.google.com stable Release.gpg Hit http://ppa.launchpad.net trusty Release.gpg Hit http://archive.canonical.com trusty/partner i386 Packages Hit http://extras.ubuntu.com trusty/main amd64 Packages Ign http://archive.ubuntu.com trusty-security InRelease Hit http://dl.google.com stable Release Hit http://ppa.launchpad.net trusty Release Hit http://extras.ubuntu.com trusty/main i386 Packages Hit http://dl.google.com stable/main amd64 Packages Hit http://archive.ubuntu.com trusty Release.gpg Hit http://ppa.launchpad.net trusty Release Hit http://dl.google.com stable/main i386 Packages Get:1 http://archive.ubuntu.com trusty-updates Release.gpg [933 B] Hit http://ppa.launchpad.net trusty Release Hit http://archive.ubuntu.com trusty-backports Release.gpg Hit http://ppa.launchpad.net trusty/main amd64 Packages Get:2 http://archive.ubuntu.com trusty-security Release.gpg [933 B] Hit http://ppa.launchpad.net trusty/main i386 Packages Hit http://archive.ubuntu.com trusty Release Get:3 http://archive.ubuntu.com trusty-updates Release [59.7 kB] Hit http://ppa.launchpad.net trusty/main amd64 Packages Ign http://archive.canonical.com trusty/partner Translation-en_PH Hit http://ppa.launchpad.net trusty/main i386 Packages Ign http://archive.canonical.com trusty/partner Translation-en Ign http://extras.ubuntu.com trusty/main Translation-en_PH Ign http://extras.ubuntu.com trusty/main Translation-en Ign http://dl.google.com stable/main Translation-en_PH Ign http://dl.google.com stable/main Translation-en Hit http://archive.ubuntu.com trusty-backports Release Hit http://ppa.launchpad.net trusty/main amd64 Packages Get:4 http://archive.ubuntu.com trusty-security Release [59.7 kB] Hit http://ppa.launchpad.net trusty/main i386 Packages Hit http://archive.ubuntu.com trusty/main amd64 Packages Hit http://archive.ubuntu.com trusty/restricted amd64 Packages Hit http://archive.ubuntu.com trusty/universe amd64 Packages Hit http://archive.ubuntu.com trusty/multiverse amd64 Packages Hit http://archive.ubuntu.com trusty/main i386 Packages Hit http://archive.ubuntu.com trusty/restricted i386 Packages Hit http://archive.ubuntu.com trusty/universe i386 Packages Hit http://archive.ubuntu.com trusty/multiverse i386 Packages Hit http://archive.ubuntu.com trusty/main Translation-en Hit http://archive.ubuntu.com trusty/multiverse Translation-en Hit http://archive.ubuntu.com trusty/restricted Translation-en Hit http://archive.ubuntu.com trusty/universe Translation-en Get:5 http://archive.ubuntu.com trusty-updates/main amd64 Packages [290 kB] Ign http://ppa.launchpad.net trusty/main Translation-en_PH Ign http://ppa.launchpad.net trusty/main Translation-en Ign http://ppa.launchpad.net trusty/main Translation-en_PH Ign http://ppa.launchpad.net trusty/main Translation-en Ign http://ppa.launchpad.net trusty/main Translation-en_PH Ign http://ppa.launchpad.net trusty/main Translation-en Get:6 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [5,820 B] Get:7 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [177 kB] Get:8 http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages [7,381 B] Get:9 http://archive.ubuntu.com trusty-updates/main i386 Packages [286 kB] Get:10 http://archive.ubuntu.com trusty-updates/restricted i386 Packages [5,820 B] Get:11 http://archive.ubuntu.com trusty-updates/universe i386 Packages [178 kB] Get:12 http://archive.ubuntu.com trusty-updates/multiverse i386 Packages [7,598 B] Hit http://archive.ubuntu.com trusty-updates/main Translation-en Hit http://archive.ubuntu.com trusty-updates/multiverse Translation-en Hit http://archive.ubuntu.com trusty-updates/restricted Translation-en Get:13 http://archive.ubuntu.com trusty-updates/universe Translation-en [87.0 kB] Hit http://archive.ubuntu.com trusty-backports/main amd64 Packages Hit http://archive.ubuntu.com trusty-backports/restricted amd64 Packages Hit http://archive.ubuntu.com trusty-backports/universe amd64 Packages Hit http://archive.ubuntu.com trusty-backports/multiverse amd64 Packages Hit http://archive.ubuntu.com trusty-backports/main i386 Packages Hit http://archive.ubuntu.com trusty-backports/restricted i386 Packages Hit http://archive.ubuntu.com trusty-backports/universe i386 Packages Hit http://archive.ubuntu.com trusty-backports/multiverse i386 Packages Hit http://archive.ubuntu.com trusty-backports/main Translation-en Hit http://archive.ubuntu.com trusty-backports/multiverse Translation-en Hit http://archive.ubuntu.com trusty-backports/restricted Translation-en Hit http://archive.ubuntu.com trusty-backports/universe Translation-en Get:14 http://archive.ubuntu.com trusty-security/main amd64 Packages [125 kB] Get:15 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [14 B] Get:16 http://archive.ubuntu.com trusty-security/universe amd64 Packages [43.4 kB] Get:17 http://archive.ubuntu.com trusty-security/multiverse amd64 Packages [1,147 B] Get:18 http://archive.ubuntu.com trusty-security/main i386 Packages [122 kB] Get:19 http://archive.ubuntu.com trusty-security/restricted i386 Packages [14 B] Get:20 http://archive.ubuntu.com trusty-security/universe i386 Packages [43.3 kB] Get:21 http://archive.ubuntu.com trusty-security/multiverse i386 Packages [1,402 B] Hit http://archive.ubuntu.com trusty-security/main Translation-en Hit http://archive.ubuntu.com trusty-security/multiverse Translation-en Hit http://archive.ubuntu.com trusty-security/restricted Translation-en Hit http://archive.ubuntu.com trusty-security/universe Translation-en Ign http://archive.ubuntu.com trusty/main Translation-en_PH Ign http://archive.ubuntu.com trusty/multiverse Translation-en_PH Ign http://archive.ubuntu.com trusty/restricted Translation-en_PH Ign http://archive.ubuntu.com trusty/universe Translation-en_PH Fetched 1,502 kB in 3min 15s (7,672 B/s) Reading package lists. Done franzbiely@Franz-Gizmo:~$ sudo apt-get upgrade Reading package lists. Done Building dependency tree Reading state information. Done Calculating upgrade. Done The following packages have been kept back: gnome-settings-daemon-schemas linux-headers-generic linux-signed-generic linux-signed-image-generic unity-settings-daemon The following packages will be upgraded: linux-libc-dev 1 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. Need to get 784 kB of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Abort. franzbiely@Franz-Gizmo:~$ 

Источник

Оцените статью
Adblock
detector