how does echo recognize, when it should output list of files or pure text?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I encountered this question in my test:
Make echo output all directories that start with a vowel (a,e,i,o,u,e), end with a number and have at least 3 characters. I thought this would be fairly easy, but soon I ended up confused and evetually failed the test.
My first thought was simply:



echo a,e,i,o,u,e*0..9


Then I tried to use square brackets



echo [a,e,i,o,u,e]*[0..9]


and at the end i tried something like this:



echo $(ls a,e,i,o,u,e*0..9)


which gave me the required output, but with some error directory missing messages, and Im not even sure if it wouldnt be considered cheating as Im using another function to do it.



Could anyone clarify for me, how do I do it and when do I use which brackets?
And I would also like to know, how does echo recognize when it should output list of directories instead of my exact words.










share|improve this question









New contributor




Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    you should use echo [aeiou]?*[0-9]
    – mosvy
    25 mins ago










  • a,e and 0..9 braces will expand even if there are no files matching them, [a,e] and [0..9] are not the proper way to write a glob range (the latter will match 0, . and 9), but [ae] and [0-9], and [ae]*[0-9] will also match filenames of two characters, thence ?* instead of *.
    – mosvy
    16 mins ago






  • 1




    echo can't differentiate files from directories, so your test can only be completed successfully if there is an implicit understanding that there are only directories that will match your wildcard pattern.
    – roaima
    3 mins ago















up vote
0
down vote

favorite












I encountered this question in my test:
Make echo output all directories that start with a vowel (a,e,i,o,u,e), end with a number and have at least 3 characters. I thought this would be fairly easy, but soon I ended up confused and evetually failed the test.
My first thought was simply:



echo a,e,i,o,u,e*0..9


Then I tried to use square brackets



echo [a,e,i,o,u,e]*[0..9]


and at the end i tried something like this:



echo $(ls a,e,i,o,u,e*0..9)


which gave me the required output, but with some error directory missing messages, and Im not even sure if it wouldnt be considered cheating as Im using another function to do it.



Could anyone clarify for me, how do I do it and when do I use which brackets?
And I would also like to know, how does echo recognize when it should output list of directories instead of my exact words.










share|improve this question









New contributor




Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    you should use echo [aeiou]?*[0-9]
    – mosvy
    25 mins ago










  • a,e and 0..9 braces will expand even if there are no files matching them, [a,e] and [0..9] are not the proper way to write a glob range (the latter will match 0, . and 9), but [ae] and [0-9], and [ae]*[0-9] will also match filenames of two characters, thence ?* instead of *.
    – mosvy
    16 mins ago






  • 1




    echo can't differentiate files from directories, so your test can only be completed successfully if there is an implicit understanding that there are only directories that will match your wildcard pattern.
    – roaima
    3 mins ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I encountered this question in my test:
Make echo output all directories that start with a vowel (a,e,i,o,u,e), end with a number and have at least 3 characters. I thought this would be fairly easy, but soon I ended up confused and evetually failed the test.
My first thought was simply:



echo a,e,i,o,u,e*0..9


Then I tried to use square brackets



echo [a,e,i,o,u,e]*[0..9]


and at the end i tried something like this:



echo $(ls a,e,i,o,u,e*0..9)


which gave me the required output, but with some error directory missing messages, and Im not even sure if it wouldnt be considered cheating as Im using another function to do it.



Could anyone clarify for me, how do I do it and when do I use which brackets?
And I would also like to know, how does echo recognize when it should output list of directories instead of my exact words.










share|improve this question









New contributor




Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I encountered this question in my test:
Make echo output all directories that start with a vowel (a,e,i,o,u,e), end with a number and have at least 3 characters. I thought this would be fairly easy, but soon I ended up confused and evetually failed the test.
My first thought was simply:



echo a,e,i,o,u,e*0..9


Then I tried to use square brackets



echo [a,e,i,o,u,e]*[0..9]


and at the end i tried something like this:



echo $(ls a,e,i,o,u,e*0..9)


which gave me the required output, but with some error directory missing messages, and Im not even sure if it wouldnt be considered cheating as Im using another function to do it.



Could anyone clarify for me, how do I do it and when do I use which brackets?
And I would also like to know, how does echo recognize when it should output list of directories instead of my exact words.







wildcards echo






share|improve this question









New contributor




Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 7 mins ago









Rui F Ribeiro

37.2k1274118




37.2k1274118






New contributor




Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 30 mins ago









Meio

41




41




New contributor




Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Meio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    you should use echo [aeiou]?*[0-9]
    – mosvy
    25 mins ago










  • a,e and 0..9 braces will expand even if there are no files matching them, [a,e] and [0..9] are not the proper way to write a glob range (the latter will match 0, . and 9), but [ae] and [0-9], and [ae]*[0-9] will also match filenames of two characters, thence ?* instead of *.
    – mosvy
    16 mins ago






  • 1




    echo can't differentiate files from directories, so your test can only be completed successfully if there is an implicit understanding that there are only directories that will match your wildcard pattern.
    – roaima
    3 mins ago













  • 1




    you should use echo [aeiou]?*[0-9]
    – mosvy
    25 mins ago










  • a,e and 0..9 braces will expand even if there are no files matching them, [a,e] and [0..9] are not the proper way to write a glob range (the latter will match 0, . and 9), but [ae] and [0-9], and [ae]*[0-9] will also match filenames of two characters, thence ?* instead of *.
    – mosvy
    16 mins ago






  • 1




    echo can't differentiate files from directories, so your test can only be completed successfully if there is an implicit understanding that there are only directories that will match your wildcard pattern.
    – roaima
    3 mins ago








1




1




you should use echo [aeiou]?*[0-9]
– mosvy
25 mins ago




you should use echo [aeiou]?*[0-9]
– mosvy
25 mins ago












a,e and 0..9 braces will expand even if there are no files matching them, [a,e] and [0..9] are not the proper way to write a glob range (the latter will match 0, . and 9), but [ae] and [0-9], and [ae]*[0-9] will also match filenames of two characters, thence ?* instead of *.
– mosvy
16 mins ago




a,e and 0..9 braces will expand even if there are no files matching them, [a,e] and [0..9] are not the proper way to write a glob range (the latter will match 0, . and 9), but [ae] and [0-9], and [ae]*[0-9] will also match filenames of two characters, thence ?* instead of *.
– mosvy
16 mins ago




1




1




echo can't differentiate files from directories, so your test can only be completed successfully if there is an implicit understanding that there are only directories that will match your wildcard pattern.
– roaima
3 mins ago





echo can't differentiate files from directories, so your test can only be completed successfully if there is an implicit understanding that there are only directories that will match your wildcard pattern.
– roaima
3 mins ago
















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Meio is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476897%2fhow-does-echo-recognize-when-it-should-output-list-of-files-or-pure-text%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Meio is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Meio is a new contributor. Be nice, and check out our Code of Conduct.












Meio is a new contributor. Be nice, and check out our Code of Conduct.











Meio is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476897%2fhow-does-echo-recognize-when-it-should-output-list-of-files-or-pure-text%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)