run zsh script in specified folder

zsh

Solution

You should just open a subshell, Execute the following from zsh or bash (including the parentheses):

(cd ~/path1 && source script1.sh)

Note: If your script is written for zsh, name it `script1.zsh` instead, since zsh syntax is not retro-compatible with old sh's.

Problem

How to run zsh script in specified folder? How to specify a folder to run a script: ``` zsh script_name.sh ``` Documents said that: "-s Force shell to read commands from the standard input. If the -s flag is not present and an argument is given, the first argument is taken to be the pathname of a script to execute." but it does not work. What is the difference between `zsh -c ~/path1/ script1.sh` (2 parameters) and `zsh -c ~/path1/script1.sh`?

Original source