I am trying to create a `tar` file of a folder, which has a lot of files to be excluded. So I wrote a script (`mytar`): 

```
#!/usr/bin/env bash

# more files to be included 
IGN=""
IGN="$IGN --exclude='notme.txt'"

tar --ignore-failed-read $IGN -cvf "$1" "$2"

# following command is working perfectly
# bash -c "tar --ignore-failed-read $IGN -cvf '$1' '$2'"

```

Test folder: 

```
test/
    notme.txt
    test.txt
    test2.txt 

```

**If I execute the script, it creates a tar file but doesn't exclude the files I have listed in `IGN`**  

Apparently, the command is: 

```
tar --ignore-failed-read --exclude='notme.txt' -cvf test1.tar test  

```

The command is working perfectly fine if it's directly executing in the shell. Also I have found a workaround for the script: using `bash -c` in script file 

```
bash -c "tar --ignore-failed-read $IGN -cvf '$1' '$2'"

```

I am wondering and trying to figure out it, 

**Why this simple command is not working without `bash -c`?**  

**Why it's working with `bash -c`?** 

Output:  

First output shouldn't container `notme.txt` file like later  

[![tar-exclude-issue-in-bash](https://i.stack.imgur.com/5VFmO.png)](https://i.stack.imgur.com/5VFmO.png)

**UPDATE 1** script updated