Why is it a bad idea to name a script `test` or a function `ls`?
BeginnerConceptShells, scripts and execution
Answer
test is a shell builtin ([ is the same command), so typing test runs the builtin and your script silently does nothing. Functions shadow commands too: a function named ls or cd in a sourced library changes behaviour for every later caller. Use unique, prefixed names (opskit_backup, deploy_rollout), and call the real command with command ls when you deliberately wrap one.
More on Shells, scripts and execution
What is a shell, and how is Bash different from sh, dash and zsh?BeginnerWhat does the shebang line do, and why prefer `#!/usr/bin/env bash` over `#!/bin/bash`?BeginnerWhat is the difference between `./script.sh`, `bash script.sh` and `source script.sh`?BeginnerWhat happens when you type a command name? How does Bash decide what to run?AdvancedWhy must `cd`, `export` and `read` be builtins rather than external programs?IntermediateWhat is the difference between a login, interactive and non-interactive shell, and which startup files run?Intermediate