2

On ubuntu and few other distros I've tried, when the user is prompted with a yes or no question, 99% of the time it prompts the user to input y or n depending on the choice. But the only exception to this --that I have seen so far-- is when adding a ppa using the add-apt-repository command. It asks you to hit ENTER to continue, or ctrl-c to cancel. Is there a specific reason behind this or is it just the way it was designed?

1
  • Sounds like a case for 100 papercuts. But I'm not sure if this is still in action...
    – MadMike
    Oct 23, 2014 at 7:20

1 Answer 1

-1

You can read script by command : cat /usr/bin/add-apt-repository. In which following lines are related to this:

# display more information about the shortcut / ppa info
    if not options.assume_yes and shortcut.should_confirm():
        try:
            info = shortcut.info()
        except ShortcutException as e:
            print(e)
            sys.exit(1)

        print(" %s" % (info["description"] or ""))
        print(_(" More info: %s") % str(info["web_link"]))
        if (sys.stdin.isatty() and
            not "FORCE_ADD_APT_REPOSITORY" in os.environ):
            if options.remove:
                print(_("Press [ENTER] to continue or ctrl-c to cancel removing it"))
            else:
                print(_("Press [ENTER] to continue or ctrl-c to cancel adding it"))
            sys.stdin.readline()

Hence it asks Press [ENTER] to continue or ctrl-c to cancel adding it which is designed and if you want to get rid of this then use : -y or --yes to Assume yes to all queries.

2
  • That's the how, but not the why, which is what this question is asking.
    – muru
    Oct 23, 2014 at 7:07
  • This comes from here.
    – Pandya
    Oct 23, 2014 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .