I have three variables $year $month and $day. Each of them gather the input from a user like: myday 20160303 or myday 2016 03 03 in different ways, I used multiple "if" statements to save in this example the first yyyy under year variable, mm under month and day accordingly. I need to use them to find out the day of the week. What I have at this moment is
nn=`date --date="$1" +"%A"`
echo "$nn"
It works with input like 20160404 but if the user type 3 arguments how can I use all three variables correctly in a date command to show the day of the week?