Article 5PR2Z Recursive loop for maxdepth=1 does not work

Recursive loop for maxdepth=1 does not work

by
sysmicuser
from LinuxQuestions.org on (#5PR2Z)
Good Morning/Afternoon/Evening All,

I am in a parent directory and I have repositories like below. It is a very rapid development environment and I want to automate git pull so no matter if I am working or not on any repo, every day I should do a git pull before I start with my work.

Directories are as below:
+ ls --color=auto
Code:AGL-IAC GO5-IAC ST8-IAC learn-terraform-locals terraform-azurerm-application-gateway terraform-azurerm-security-groups
Azure-IaC-Buildsheet GO7-IAC TST-IAC tenancy-instances terraform-azurerm-eventhub terraform-azurerm-storage-account
My hacky shell script is like below:

Code:for dir in *; do [ -d "$dir" ] && cd "$dir" && git remote -v && git pull & cd ..; done;
+ for dir in *
[2] 281
+ cd ..
+ '[' -d AGL-IAC ']'
+ for dir in *
+ cd AGL-IAC
+ git remote -v
[3] 282
+ '[' -d Azure-IaC-Buildsheet ']'
+ cd ..
+ for dir in *
[4] 284
+ cd ..As you see above it is not working as expected, how to make it work properly, and is it possible to set Azure Repo Userid and PAT Token so I do not have to enter it when the script runs?latest?d=yIl2AUoC8zA latest?i=WD6gFuto_zM:sndxHW4Rdpc:F7zBnMy latest?i=WD6gFuto_zM:sndxHW4Rdpc:V_sGLiP latest?d=qj6IDK7rITs latest?i=WD6gFuto_zM:sndxHW4Rdpc:gIN9vFwWD6gFuto_zM
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments