I'm trying to write a script that accepts 2 command line arguments e.g. one a directory name the other a symbol (any symbol can be $,,^,* and so on). It should then check if the directory has a file name that has that symbol and if it doesn't add the symbol to the directory. So if I looked for a directory called testDir as first argument and had a * as the second argument it would check for files in that directory to see if there is that symbol in a file and if there wasn't the directory would now be called testDir*. Here is a bit of code that I'm trying to develop on. a1=$1    symbol=$(ls $a1 | grep $2)   if [ $symbol !=  ]     then     echo file has Symbol   else     echo The symbol was added to directory     mv $a1 $1$2    fiIt seemed to work OK with the @ symbol so I believe its been effected by the special characters. Is there any way to try escape special characters but also work with non-special characters?
Unexpected result when using command line arguments to look for file with symbol
shell script