How can I generate random answer string like "yes,no,maybe maybe not? The Next CEO of Stack OverflowWhich are the standard commands available in every Linux based distribution?How to efficiently generate large, uniformly distributed, random integers in bash?How to get binary representations of strings in Shell?The best way to add Unix Shell variables to CURL GET requestHow to list only JPEG files from root below using the command line?How to generate a random string?iptables: does making use of -m conntrack increase system load?wall forces everyone to input something to get back to the promptRunning script through ssh and evaluate some var/comand inside the host machineSed Fails to store the result into a variable

Is it professional to write unrelated content in an almost-empty email?

Touchpad not working on Debian 9

Is it convenient to ask the journal's editor for two additional days to complete a review?

Does destroying a Lich's phylactery destroy the soul within it?

Expectation in a stochastic differential equation

Decide between Polyglossia and Babel for LuaLaTeX in 2019

"Eavesdropping" vs "Listen in on"

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

How to find image of a complex function with given constraints?

How to use ReplaceAll on an expression that contains a rule

Won the lottery - how do I keep the money?

Help/tips for a first time writer?

Is a distribution that is normal, but highly skewed, considered Gaussian?

Easy to read palindrome checker

Is it ok to trim down a tube patch?

Reshaping json / reparing json inside shell script (remove trailing comma)

Film where the government was corrupt with aliens, people sent to kill aliens are given rigged visors not showing the right aliens

Getting Stale Gas Out of a Gas Tank w/out Dropping the Tank

What does "shotgun unity" refer to here in this sentence?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Is fine stranded wire ok for main supply line?

Can I calculate next year's exemptions based on this year's refund/amount owed?

Purpose of level-shifter with same in and out voltages

Can Sneak Attack be used when hitting with an improvised weapon?



How can I generate random answer string like "yes,no,maybe maybe not?



The Next CEO of Stack OverflowWhich are the standard commands available in every Linux based distribution?How to efficiently generate large, uniformly distributed, random integers in bash?How to get binary representations of strings in Shell?The best way to add Unix Shell variables to CURL GET requestHow to list only JPEG files from root below using the command line?How to generate a random string?iptables: does making use of -m conntrack increase system load?wall forces everyone to input something to get back to the promptRunning script through ssh and evaluate some var/comand inside the host machineSed Fails to store the result into a variable










0















I dont know how can I generate random answer.



exemple result:



user:~$ ./question.sh do you love me ?
user:~$ yes


or



user:~$ ./question.sh do you hate me ?
user:~$ maybe


I try to put all the String in a variable like :



d='yes','no','maybe' etc..
but the message errors is always : impossible : not found









share|improve this question



















  • 1





    Traditionally, when folks have a problem they want help with, they post their code, which I don't see here. Please click edit and add the contents of question.sh so we may provide assistance.

    – K7AAY
    2 days ago
















0















I dont know how can I generate random answer.



exemple result:



user:~$ ./question.sh do you love me ?
user:~$ yes


or



user:~$ ./question.sh do you hate me ?
user:~$ maybe


I try to put all the String in a variable like :



d='yes','no','maybe' etc..
but the message errors is always : impossible : not found









share|improve this question



















  • 1





    Traditionally, when folks have a problem they want help with, they post their code, which I don't see here. Please click edit and add the contents of question.sh so we may provide assistance.

    – K7AAY
    2 days ago














0












0








0








I dont know how can I generate random answer.



exemple result:



user:~$ ./question.sh do you love me ?
user:~$ yes


or



user:~$ ./question.sh do you hate me ?
user:~$ maybe


I try to put all the String in a variable like :



d='yes','no','maybe' etc..
but the message errors is always : impossible : not found









share|improve this question
















I dont know how can I generate random answer.



exemple result:



user:~$ ./question.sh do you love me ?
user:~$ yes


or



user:~$ ./question.sh do you hate me ?
user:~$ maybe


I try to put all the String in a variable like :



d='yes','no','maybe' etc..
but the message errors is always : impossible : not found






linux shell-script terminal string






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Rui F Ribeiro

41.8k1483142




41.8k1483142










asked 2 days ago









ZPUFF19ZPUFF19

84




84







  • 1





    Traditionally, when folks have a problem they want help with, they post their code, which I don't see here. Please click edit and add the contents of question.sh so we may provide assistance.

    – K7AAY
    2 days ago













  • 1





    Traditionally, when folks have a problem they want help with, they post their code, which I don't see here. Please click edit and add the contents of question.sh so we may provide assistance.

    – K7AAY
    2 days ago








1




1





Traditionally, when folks have a problem they want help with, they post their code, which I don't see here. Please click edit and add the contents of question.sh so we may provide assistance.

– K7AAY
2 days ago






Traditionally, when folks have a problem they want help with, they post their code, which I don't see here. Please click edit and add the contents of question.sh so we may provide assistance.

– K7AAY
2 days ago











1 Answer
1






active

oldest

votes


















4














#!/bin/bash

array=( yes no maybe )
read -p 'do you hate me ? [press a key] >>> '
echo $arr[RANDOM % $#array[@]]





share|improve this answer

























  • Also see stackoverflow.com/questions/13888735/… and codegolf.stackexchange.com/questions/157546/…

    – K7AAY
    2 days ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509450%2fhow-can-i-generate-random-answer-string-like-yes-no-maybe-maybe-not%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














#!/bin/bash

array=( yes no maybe )
read -p 'do you hate me ? [press a key] >>> '
echo $arr[RANDOM % $#array[@]]





share|improve this answer

























  • Also see stackoverflow.com/questions/13888735/… and codegolf.stackexchange.com/questions/157546/…

    – K7AAY
    2 days ago















4














#!/bin/bash

array=( yes no maybe )
read -p 'do you hate me ? [press a key] >>> '
echo $arr[RANDOM % $#array[@]]





share|improve this answer

























  • Also see stackoverflow.com/questions/13888735/… and codegolf.stackexchange.com/questions/157546/…

    – K7AAY
    2 days ago













4












4








4







#!/bin/bash

array=( yes no maybe )
read -p 'do you hate me ? [press a key] >>> '
echo $arr[RANDOM % $#array[@]]





share|improve this answer















#!/bin/bash

array=( yes no maybe )
read -p 'do you hate me ? [press a key] >>> '
echo $arr[RANDOM % $#array[@]]






share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered 2 days ago









Gilles QuenotGilles Quenot

16.4k14053




16.4k14053












  • Also see stackoverflow.com/questions/13888735/… and codegolf.stackexchange.com/questions/157546/…

    – K7AAY
    2 days ago

















  • Also see stackoverflow.com/questions/13888735/… and codegolf.stackexchange.com/questions/157546/…

    – K7AAY
    2 days ago
















Also see stackoverflow.com/questions/13888735/… and codegolf.stackexchange.com/questions/157546/…

– K7AAY
2 days ago





Also see stackoverflow.com/questions/13888735/… and codegolf.stackexchange.com/questions/157546/…

– K7AAY
2 days ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509450%2fhow-can-i-generate-random-answer-string-like-yes-no-maybe-maybe-not%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.