A
A
Alexander2016-11-04 14:53:58
linux
Alexander, 2016-11-04 14:53:58

How to accept --key=value in BASH script?

I’ll make a reservation right away, I’m not particularly friendly with bash. But I just can't figure out what words to look for the solution of the problem:
to accept in the script --key=value
What is this? Array, parameter, option?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2016-11-04
@Sashkett

--key=value
this is the general principle how to pass long options with parameters.
Either you parse $1 inside the script, or you can try to read how to use getopts (not to be confused with getopt)
But it's easier to parse $1 by splitting it into two parts with the same
cut -d "=" -f 2

S
sim3x, 2016-11-04
@sim3x

https://www.google.com.ua/search?q=bash+get+key-va...
upd
https://www.google.com.ua/search?q=bash+get+key-va ...
mywiki.wooledge.org/BashFAQ/035

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question