I am not sure if this is a bug or not. Her is an example of my script that I am running. #!/bin/bash rm -f x.txt rm -f new_file i=1 wc -l file1 | sed 's/file1//g' >> x.txt x=$(> new_file grep $A some_file.txt ((i++)) done grep does not appear to be grepping inside of the while loop. When I initialize a variable directly from the command line and write the same script it works no problem, any help on this matter would be greatly appreciated.