Question: I recently started using the adb command line utility tool and what I'm trying to do is to extract all of the images from a folder on my android device.
I've tried the command below with no success.

```
 adb pull /data/media/0/Pictures/Screenshots/*.png   /root/Desktop

```

I've also tried a specific image

```
 adb pull '/data/media/0/Pictures/Screenshots/Screenshot_2017-12-15-04-51-19.png'

```

every time i run the adb pull command i seem to get the error

```
 adb: error: remote object '/root/data/media/0/Pictures does not exist'

```

adb is case sensitive, so i made sure i was accurate before proceeding with the above commands

update: I have tried the adb push command but it outputs the error code 

```
 adb: error: failed to copy : Read-only file system

```

i failed to mention in the above example of pulling a file from my adb device, i was successful in pulling 5 wifi files, but the picture extractions remain unknown... at this point i have narrowed it down to the media folder, it will extract the data, but anything past it gets lost, file not found.

Answer: 
Let's modify your script slightly:

```
$ cat add.sh
#!/bin/bash
add() {
  sum=0
  for num
  do
          sum=$((sum +num))
  done
}

add "$@"
echo "sum=$sum"

```

Now, let's run the script:

```
$ bash add.sh 4 -3 9 12
sum=22

```

It works.

The only change is that we called your function via `add "$@"` before echoing `sum`.
Just to include the *actual* simple way to do this:

```
#!/bin/bash
IFS=+
bc <<< "$*"

```

And using it (when in a file called `add.sh` on which you have execute permissions):

```
$ ./add.sh 4 -3 9 12
22
$ 

```

Or just define it as a function in your `~/.bashrc` or in the larger bash script you're writing:

```
add() (
  IFS=+
  bc <<< "$*"
)

```