I have a shell script which take input parameters from command line. Below are only two options:
./test.sh 20180415 20180416 20180417 20180418 2
./test.sh 20180418 2
The first option takes 5 input parameters, out of which first four are in date format "YYYYMMDD" and I want to store those dates in array variable: sets_date=("$@") and the last parameter which is 2 I will store it in the different variable.
The second option takes 2 input parameters, in which the first one is in same date format and I still want to store that date in array variable and last parameter in the different variable. These are the only two options I will have.
#!/bin/bash
sets_date=("$@")
# store number in variable
Is this possible to do in a shell script? So either my shell script takes 5 input parameters or only 2 input parameters and there won't be any other combinations.