I am trying to write a script then search for all the directories with the given substring but I am getting the following error.
I have no idea why this is happening.. can someone please guide me ?
#!/bin/bash
echo $1
for recordings in $1/*/ ; do
echo $recordings | grep -q "XavierA"
echo $?
if ["$?" -eq 0];then
echo "found."
fi
done
The output is this
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found
0
./readallfiles.sh: line 7: [0: command not found
1
./readallfiles.sh: line 7: [0: command not found