[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Functions and interactive scripts
From: |
Richard Taubo |
Subject: |
Re: [Help-bash] Functions and interactive scripts |
Date: |
Thu, 19 Mar 2015 11:47:41 +0100 |
On 19 Mar 2015, at 11:30, Pierre Gaston <address@hidden> wrote:
>
> the most straightforward is to use read -p as it prints the prompt on
> standard error
>
> function ask_question() {
> read -p "$1" ans
> printf "Answer: %s\n" "$ans"
> }
>
> Using a global variable is not a bad idea either, as it avoids the subshell
> and is faster.
OK, thanks for the input!
Best regards,
Richard Taubo