Score:0

How can I append the output of `lsattr` at the start of every line in the output of `ls -l`?

cn flag

I'd like to get the following output:

----i---------------- 201820 -r--r-----  1 root    root     0 Dec 5 10:22 .indestructible
--------------------- 170834 -rw-rw-r--+ 1 user101 user101 3K Dec 2 12:33 another-file
\___________________/ \_________________________________________________________________/
       lsattr                                      ls -halF

What would a function look like that I could alias to l to get this kind of output?

waltinator avatar
it flag
Write a `bash` function using `stat` and `lsattr` to produce your desired output. Read `man stat lsattr bash`. Parsing `ls` output is a Well Known Bad Idea.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.