Skip to main content
deleted 6 characters in body
Source Link
Mayube
  • 11.7k
  • 2
  • 48
  • 93

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks likewill be this:

E37@vimmachine: /var/override)

While the error looks likewill be this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it should not give any more output (except for whitespace).

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks like this:

E37@vimmachine: /var/override)

While the error looks like this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it should not give any more output (except for whitespace).

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt will be this:

E37@vimmachine: /var/override)

While the error will be this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it should not give any more output (except for whitespace).

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

Tweeted twitter.com/StackCodeGolf/status/877167829744836608
added 24 characters in body
Source Link
Mayube
  • 11.7k
  • 2
  • 48
  • 93

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks like this:

E37@vimmachine: /var/override)

While the error looks like this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it should not give any more output (except for whitespace).

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks like this:

E37@vimmachine: /var/override)

While the error looks like this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it should not give any more output.

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks like this:

E37@vimmachine: /var/override)

While the error looks like this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it should not give any more output (except for whitespace).

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

added 18 characters in body
Source Link
Mayube
  • 11.7k
  • 2
  • 48
  • 93

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks like this:

E37@vimmachine: /var/override)

While the error looks like this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it may terminateshould not give any more output.

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks like this:

E37@vimmachine: /var/override)

While the error looks like this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it may terminate.

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

Vim is a great text editor for unix systems, but it's notorious for being difficult to exit.

Write a full program that will output :q to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which case there are unsaved changes.

The bash prompt looks like this:

E37@vimmachine: /var/override)

While the error looks like this:

E37: No write since last change (add ! to override)

Upon being given the bash prompt, the program's work is done, and it should not give any more output.

Upon being given the error, your program should randomly (ie each possibility has a non-zero probability of being chosen) output :q!, to exit without saving, or :x, to save and exit.

This is so fewest bytes in each language wins!

edited body; edited title
Source Link
Mayube
  • 11.7k
  • 2
  • 48
  • 93
Loading
Source Link
Mayube
  • 11.7k
  • 2
  • 48
  • 93
Loading