[NTLUG:Discuss] Auto-completion within a bash script?
Leroy Tennison
leroy_tennison at prodigy.net
Thu Apr 16 18:45:36 CDT 2009
Lance Simmons wrote:
> On Thu, Apr 16, 2009 at 12:23 PM, Eric Waguespack <ewaguespack at gmail.com> wrote:
>> I am not aware of any way to allow auto completion in a bash script,
>> (at the read prompt).
> [...]
>> change
>> read ATTACHMENT
>> to
>> ATTACHMENT="$1"
>> then you would have your auto completion, though it would be at script
>> initiation, not during execution.
>
> That was how I did it in the past, but the problem was that I kept
> forgetting in what order to place the four arguments (file with list
> of addresses, file with message, subject heading, and, if
> appropriate, attachment file). The two important ones are the
> message file and the attachment file, so maybe I should use two
> (auto-completed) arguments and then two read prompts for the
> list of addresses and the subject line.
An option I use a fair amount in scripts is to print a help message if
there are no command line arguments. That way I don't have to remember
anything, just execute the script knowing it won't run but giving me the
help I need.
More information about the Discuss
mailing list