I want to select the options for this script via command line.
For example I want to choose option 2, but this requires entering the number and pressing Enter. I tried to enter ./install.sh < 2
, but got the error Invalid selection. Installation aborted.
.
How can I do this correctly?
Both these solutions work:
For multiple options use e.g.:
In your case that would be:
If you use this way of entering options it's crucial that you specify all options needed, it won't work (this way) to just specify the first two and leave the others open for the user to choose.
More about here strings (
<<<
) can be found on tldp.org and Command line: <<< instead of <<.