nick34992
2/21/2017 - 9:49 PM

Bash: ls, cat -n, echo: Display Listing of Filenames in Directory

Bash: ls, cat -n, echo: Display Listing of Filenames in Directory

#!/bin/bash

cat_n_ls=$(ls | cat -n)
echo "$cat_n_ls" # quotes preserve \n