I am writing a bash script and I want to prevent the user from running the script as
$ ./myscript.sh
and instead, run it as
$ . ./myscript.sh
Is this possible to be done in CentOS 7?
So my approach was to check for the first .
and see if it exists. I tried the following. Seems like it is not printing the full string executed at the command line.
Content of myscript.sh
#!/bin/bash
for i; do
echo $i
done