Question: I have an array of object 

```
people = [
   {fName:"George", sName:"Nina", age:20},
   {fName:"Robert", sName:"Brown", age:30},
   {fName:"Davie", sName:"Wilson", age:40}
]

```

I want to create simple array by filtering the array of object. Like this:

```
newPeople=["George Nina","Robert Brown", "Davie Wilson"]

```

Can some want help me with it?

Answer: 
you can use the `-C` option of `git`. from `man git`:

> 
> **-C path**
> 
> 
> Run as if git was started in `path` instead of the current working
>  directory. When multiple `-C` options are given, each subsequent
>  non-absolute `-C path` is interpreted relative to the preceding `-C path`.
> 
> 
> ...
> 
> 
> 

for example:

```
#!/bin/sh

REPOSITORIES="/home/user/repos"

for repo in "$REPOSITORIES"/*/; do
        echo "Updating $repo at `date`"
        if [ -d "$repo/.git" ]; then
                git -C "$repo" status
                echo "Fetching"
                git -C "$repo" fetch
                echo "Pulling"
                git -C "$repo" pull
        else
                echo "Skipping because it doesn't look like it has a .git folder."
        fi
        echo "Done at `date`"
        echo
done

```

the line:

```
for repo in "$REPOSITORIES"/*/; do

```

allows you to [iterate over just directories](https://unix.stackexchange.com/questions/86722/how-do-i-loop-through-only-directories-in-bash), then if it contains a git repository, run the git commands on that directory.

**edit**: added directory base path
Can you be more specific about what isn't working? Is the script doing anything at all?

Is the script in the repos directory?

```
REPOSITORIES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

```

gets you the directory where actual script is, not the directory where you run it from.

```
REPOSITORIES="$( cd "/home/user/repos/")"

```

won't work because you're just starting a subshell, changing directories, then not actually outputting anything. If you just want to hardcode the directory name, then do this:

```
REPOSITORIES="/home/user/repos"

```

Also, iterating over the output of `ls` is bad practice, ls output isn't designed to be parsed programmatically. Use

```
for REPO in "$REPOSITORIES"/*

```