Q:

Does Bash support command.subcommand structure in addition to command subcommand structure? If yes, how to incorporate this in bash scripts?

After installing microk8s (Micro Kubernetes) on my local machine, one of the commands I encountered was microk8s.enable dns which can also be run as microk8s enable dns. This doesn't seem to be a universal thing. git status is a valid command but git.status is not. How do Linux systems support such type of command structures? How can I incorporate this behavior in my Bash scripts?

A:

You'll sometimes see programs (and scripts) inspect the name of the file that was used to invoke the program and condition behavior off of that.
Consider for example this file and symbol link:
$ ls -l
-rwxr-xr-x  ... foo
lrwxr-xr-x  ... foo.bar -> foo

And the content of the script foo:
#!/bin/bash

readonly command="$(basename "${0}")"
subcommand="$(echo "${command}" | cut -s -d. -f2)"

if [[ "${subcommand}" == "" ]]; then
    subcommand="${1}"
fi

if [[ "${subcommand}" == "" ]]; then
    echo "Error: subcommand not specified" 1>&2
    exit 1
fi

echo "Running ${subcommand}"

The script parses the command name looking for a subcommand (based on the dot notation in your question).  With that, I can run ./foo.bar and get the same behavior as running ./foo bar:
$ ./foo.bar
Running bar

$ ./foo bar
Running bar

To be clear, I don't know that that's what microk8s.enable is doing.  You could do a ls -li $(which microk8s.enable) $(which microk8s) and compare the files.  Is one a link to the other?  If not, do they have the same inode number?

