I am writing one shell script in which I am supposed to create 1 text file. When I do this, a question mark comes at the end of file name. what is the reason?
I am trying below methods in bash script.
grep ERROR a1* > text.txt
Sounds like you script uses
\r\n as line endings, this is typical DOS style line endings. Unix like systems uses
\n. You should try to remove the line feeds, eg with your favorite text editor:
vim +'set ff=unix | x' my_script
sed -i 's/\r$//' my_script