shell - How to force "echo *" to print items on separate lines in Unix? -


is * variable? when echo * lists working directory on 1 line. how can force command print each item on separate line?

the correct way ditch non-portable echo in favor of printf:

 printf '%s\n' * 

however, printf (and echo) way have drawback: if command not built-in , there lot of files, expanding * may overflow maximum length of command line (which can query getconf arg_max). thus, list files, use command designed job:

ls -1 

which doesn't have problem; or even

find . 

if need recursive lists.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -