Bash: ls, cat -n, echo: List Filenames of Current Directory
cat_n_ls=$(ls | cat -n) assigns
ls | cat -n to a variable.
ls lists filenames in the current directory. Which is then passed to
cat -n which numbers each line.
echo "$cat_n_ls" then displays the result.
"$cat_n_ls" has quotation marks to preserve newlines. The script above returns something similar to the following example: