3 ms·
Quiz; in any directory, full or empty I can run this command $ * and get * What allows me to do this? (the $ is the prompt, not what I typed)
by emmelaich 7y ago
Quiz; in any directory, full or empty I can run this command
$ *
and get
*
What allows me to do this? (the $ is the prompt, not what I typed)
- foota 7y agoDoes bash not do expansion for the program name?
- iudqnolq 7y agoYou can't, at least on bash version 5.0.3(1)-release with the default config Ubuntu packages it with. After a lag I get the error `$folder_name$: command not found`
- emmelaich 7y agoI promise you you can, with a previous particular incantation. Answer to come. PS. the response is not important.
- iudqnolq 7y agoOh, I thought you meant in an arbitrary directory. If the first file in sorted order is executable and prints "*" to stdout you could get that.
- emmelaich 7y agoI did mean an arbitrary directory. Your answer almost works; but only if PATH includes the current directory which is unusual. It does hint at another almost answer ... mkdir t cd t ln -s $(type -p ls) *
- ridiculous_fish 7y agoGLOBIGNORE=*; *(){ echo *; } welp
- emmelaich 7y agoCorrect! More or less. Mine uses alias rather than a function. alias \*='set noglob; echo \*' Works because alias expansion is done before globbing.