Finally, after fiddling around I am able to resolve the issue.
As per the WiringPi setup guide to set the direction of a gpio u should use
gpio mode 21 out
This method works if you are using #!/bin/sh shell
But if you want to use #!/bin/bash shell then you have to use
gpio -g mode 21 out
After, setting up the direction with use of '-g' I am ...
Plex media server has shut down the repository at https://dev2day.de/. They have moved to https://downloads.plex.tv/repo/deb. This page provides the installation instructions, in essence, you need to run:
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
Check out this post on the difference between sh and bash:
In summary of key points, sh is really a standard and bash was originally an implementation of that standard that evolved to have a lot of extensions, some of which caused it to deviate from the standard.
When you do #!/bin/...