Hello all,
I want to write a shell script to list the contents of a directory and number them and write them to a file.
For example, if I have a directory temp and the contents of the directory are alpha, beta and gamma. I want to write these filenames to a file "test" in a numbered manner.
#cd temp #ls
alpha beta gamma
The output of test file should be,
alpha
beta
gamma
The contents of the directory can vary, so I want to write a dynamic script. Please help