grep filename[asterisk] returns unexpected result
问题 I have a basic question about ls command. Suppose in a directory I have 4 files named run run1 running run.sh So, if i do: ls -l|grep run* then I get no result. But if i do ls -l|grep run.* then I get run.sh as a result. However I expected grep to list all of the files in both the cases. Could you make me understand what is going on behind scenes? 回答1: As long as I understand, the "*" is expanded by the shell before executing the command itself, so your grep will try to catch a string with