I am working on one script where I am trying to display all the directories which is inside the workspace but somehow it is giving me weird output and this is occurring only with one directory other also having the result.html file inside the directory.
for i in `ls -1 | egrep -iv "hotfix|branch|TotalLinesOfCode"`;do echo $i;done
I am very confused. The title of this thread is Now showing the correct output, but you seem to be saying that you your script is NOT showing the correct output???
The script you showed us cannot possibly produce the output you showed us. Without quotes around the operand in your echo command, it will never print a leading space in a filename (even if you actually have files named <space>Output and <space>removeScmSyncErrorLogFilejob where the <space> stands for a literal space character in your filenames).
Please answer the following questions to clarify what you are trying to do:
What is your definition of a "workspace"? (Your ls command is going to list the contents of the current working directory; not all of the files in the file hierarchy rooted in the current working directory.)
What operating system and shell are you using?
What is the output from the command ls -1 in the directory where you ran your script?