3 ms·
I use `echo *`
by beermonster 5y ago
I use `echo *`
- vidarh 5y ago`echo *` has many of the downsides of ls (doesn't escape e.g. space in filenames) and additionally breaks on directories where the expansion fills the command line buffer. EDIT: Also note that "find ..." is also not safe from all the quoting issues without "-print0" or equivalent options to make it separate the names with ASCII NUL rather than linefeed or otherwise taking steps to handle filenames with actual linefeeds in them.
- xorcist 5y agoIndeed. Those backticks only works in a shell, but in a shell why not just write * which is how filename expansion is supposed to work.
- beermonster 5y agoThe back ticks were supposed to be quotes, I meant to say echo * However as per replies, this suffers from the same issues as ls.
- vidarh 5y agoThe problem is not the backticks. They were just used as quote characters. The problem is that shell expansion doesn't escape the characters. E.g. this is a cut down output from my system now after I did a echo >'/tmp/ space ': $ echo /tmp/* /tmp/bspwm_0_0-socket /tmp/config-err-Q667kI /tmp/foolog /tmp/ space /tmp/... Parse that output and you get a broken list of filenames.