Re:Crush: A command line shell that is also a powerful moder...
by ratboy666 on Friday August 07, 2020 @12:24PM
(#24083657)
You are correct. It is all about how you think about things.
"ls" lists files. Sure. Simple interactive command. But, thinking about this, "echo " also lists files. "ls" provides information about files. Sure. Simple interactive command. But, "stat" specifically provides information.
So, I would reach for
stat --format "%n %a"
To get name and octal permissions. You are correct, and wrong at the same time. Easy enough to accomplish -- but using * instead of ls. Note that the "space in filename" becomes the big issue (use %N in stat format).
So your conclusion is 100% correct. Thank you for your post and insight
Re:Crush: A command line shell that is also a powerful moder...
by moonchild on Friday August 07, 2020 @05:48PM
(#24086803)
> Choosing one column from "ls" output for example is not simple, bordering on impossible using the consistent behaviour of standard pipes.
ls -l | awk '{print $3}'
ls -l | cut -f 3 -d ' '
Sometimes the inconsistent solution will be simpler by moving the complexity to the choice of the mode of interaction. Sometimes not.