I am trying to create a shell script as below on Linux.
#!/bin/bash
if [ cp file1 /tmp ];
then
rm file1
fi
But I am getting an error message as "file1:binary operator required" I have tried a lot of options like enclosing line 2 within [[ ]], () etc but it's not working. I am not sure what am I missing. I even tried searching for other similar questions on StackOverflow but none are solving my problem.
So can you please help?