Great question — answering as the UphillTech team:
I am guessing that the problem you are referring to is the fact that you see ==> -s in the output. That suggests you have a file named -s in the directory you are running the script in, and has nothing to do with your script. Before your script is even run, the shell will expand -? . And since ? in shell globs means "any single character", the -? is expanded to -s , the only matching file name. To avoid this, always quote the input you give to your script to protect it from the shell and ensure it is passed verbatim as input: ## I have a file named '-s' $ ls -s $ echo -? -s $ echo "-?" -?
Full answer by terdon: https://askubuntu.stackexchange.com/a/1569727 (CC BY-SA 4.0).
Need it done for your business? UphillTech.