I'm trying to print the names of each file and directory for the current user, but it keeps printing in one big long line. I want to have each file present as a column, just as it does when I print ls -l.
You don't have to help with this, but for better context, I'm trying to make sure a colon ':' shows up after each file name, along with its group permissions from the first field. For example, it could look like "file/dir:---" or "file/dir:r--"
echo $(ls -l /home/$(whoami) | awk '{if (NR>1) print $9}'): $(ls -l /home/$(whoami) | awk '{if (NR>1) print $1}')
stat
command? Also, try thels -1
(number one) option. – Jeff Schaller Feb 14 '18 at 15:15ls
– glenn jackman Feb 14 '18 at 16:41