I'm working inside a Zsh terminal on a Mac.
I'm trying to use the source command so that I can just call my script by name, rather than typing the path to the ".sh" script. The source command does not return any errors, but once I try calling the ".sh" file by name it returns "command not found."
I've also tried typing in the absolute path when using the source command, but with no luck.
Terminal commands:
source ~/Documents/marco.sh
marco
zsh: command not found: marco
marco.sh
#!/usr/bin/env bash
touch ~/Documents/marco.txt
echo $(pwd) > ~/Documents/marco.txt
sourcedoesn't make the script available by name; it just executes each command in the given file in the current shell, as opposed to in a new process.~/Documentsto yourPATHvariable, in which case you could runmarco.sh. If youmarcoalone to work, you'll need to define an alias, or a function, or create a symlink to~/Documents/marco.shin one of your PATH directories, etc.~/bindirectory, add it to yourPATHnear the front, and put the command in there.