Skip to main content
added 24 characters in body
Source Link
Mau
  • 191
  • 1
  • 6

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

Bash version = 3.2.51

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform echo "Stored name: " ${SuggestDefaultPlatform} 

which prompts:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4_ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

our-platform-7.26-2.17-res_ our-platform-7.26-2.17-re_ our-platform-7.26-2.17-r_ our-platform-7.26-2.17-_ our-platform-7.26-2.17_ our-platform-7.26-2.1_ our-platform-7.26-2.18-alpha1_ 

Press Enter.

which prompts:

Stored name: our-platform-7.26-2.18-alpha1 

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform echo "Stored name: " ${SuggestDefaultPlatform} 

which prompts:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4_ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

our-platform-7.26-2.17-res_ our-platform-7.26-2.17-re_ our-platform-7.26-2.17-r_ our-platform-7.26-2.17-_ our-platform-7.26-2.17_ our-platform-7.26-2.1_ our-platform-7.26-2.18-alpha1_ 

Press Enter.

which prompts:

Stored name: our-platform-7.26-2.18-alpha1 

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

Bash version = 3.2.51

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform echo "Stored name: " ${SuggestDefaultPlatform} 

which prompts:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4_ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

our-platform-7.26-2.17-res_ our-platform-7.26-2.17-re_ our-platform-7.26-2.17-r_ our-platform-7.26-2.17-_ our-platform-7.26-2.17_ our-platform-7.26-2.1_ our-platform-7.26-2.18-alpha1_ 

Press Enter.

which prompts:

Stored name: our-platform-7.26-2.18-alpha1 
minor modification of initial script. add visual animation of command line prompt.
Source Link
Mau
  • 191
  • 1
  • 6

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform   echo "Stored name: " ${SuggestDefaultPlatform} 

which prompts:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _res4_ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

our-platform-7.26-2.17-res_ our-platform-7.26-2.17-re_ our-platform-7.26-2.17-r_ our-platform-7.26-2.17-_ our-platform-7.26-2.17_ our-platform-7.26-2.1_ our-platform-7.26-2.18-alpha1_ 

Press Enter.

which prompts:

Stored name: our-platform-7.26-2.18-alpha1 

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform 

which prompts:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform   echo "Stored name: " ${SuggestDefaultPlatform} 

which prompts:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4_ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

our-platform-7.26-2.17-res_ our-platform-7.26-2.17-re_ our-platform-7.26-2.17-r_ our-platform-7.26-2.17-_ our-platform-7.26-2.17_ our-platform-7.26-2.1_ our-platform-7.26-2.18-alpha1_ 

Press Enter.

which prompts:

Stored name: our-platform-7.26-2.18-alpha1 
added 6 characters in body
Source Link
bahamat
  • 40.9k
  • 5
  • 76
  • 104

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform 

which prompts:

@@@@@@@@@@

@ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]:

@@@@@@@@@@

our-platform-7.26-2.17-res4

_

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with 'our-platform-7.26-2.17-res4' as your platform name? [Y/n]...

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@

@ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]:

@@@@@@@@@@

our-platform-7.26-2.17-res4 _

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform 

which prompts:

@@@@@@@@@@

@ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]:

@@@@@@@@@@

our-platform-7.26-2.17-res4

_

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with 'our-platform-7.26-2.17-res4' as your platform name? [Y/n]...

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@

@ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]:

@@@@@@@@@@

our-platform-7.26-2.17-res4 _

so that the user can move the cursor, modify the suggestion and/or press Enter.

What can I do to leave the cursor on the same line of the suggestion in a Bash script?

It's purpose is to suggest a string so that the user should only press Enter.

#!/bin/sh echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform 

which prompts:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

where the underscore "_" stands for the cursor.

I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform " variable

SuggestDefaultPlatform='our-platform-7.26-2.17-res4'; 

and then prompt a question like:

Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]... 

Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform " variable:

@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@ our-platform-7.26-2.17-res4 _ 

so that the user can move the cursor, modify the suggestion and/or press Enter.

Source Link
Mau
  • 191
  • 1
  • 6
Loading