by rkta · 2y ago · 0 comments
And it's an easy fix:
- for project in $(ls go-cicd); do
+ cd go-cicd || exit 1; for project in \*; do for project in go-cicd/*; do
project="${project#*/}"That said, if you do (ie: scratch files, things outside of control, whatever), consider the directory stack:
https://www.gnu.org/software/bash/manual/html_node/Directory...
Using 'pushd' and 'popd' can save your fingers/brain from getting lost in context.
(
cd dir
for f in ./*; [..]
)
There's a few scenarios where this won't work (mainly if you want to set a variable from the "outer scope"), but 99% of the time it works nicely.