3

I came across this picture (below), obviously it is a pun or some kind of allusion incorporating command-line expressions. Frankly speaking I do not understand anything of it except for grep -n. However, I searched for the string "**/*" via google and I did not even get one hit.

      image with **/* example command

5
  • 5
    That's zsh recursive globbing now supported by a few other shells Commented Feb 24, 2015 at 21:41
  • This should be closed as off-topic because asp is Microsoft file extension. Commented Feb 24, 2015 at 22:10
  • 3
    @jimmij you can serve asp on Linux via mod_mono. Commented Feb 24, 2015 at 23:18
  • 1
    @jimmij besides, you can run grep via cygwin. Commented Feb 25, 2015 at 2:35
  • so, if "*/" is recursive does it display all paths that exist in the filesystem? I ask, because I tried two commands: 1) find / | wc -l 2) ls */ | wc -l .....the first command had more than ten times as many lines Commented Feb 25, 2015 at 16:02

1 Answer 1

2

To round out the comments into an Answer,

  • grep -n will search for the given expression in the given files or standard input, reporting the line number that matches were found on.
  • \"in$Ps\" is the expression that grep is looking for. Since the double-quotes are quoted, they are part of the text that grep will search for. The $Ps part is a little unclear to me, since the shell will try to interpret Ps as a variable name.

    If $Ps is not set, then grep will search for the text: "in".

    If $Ps is set, then the shell will replace that part of the expression with the value of $Ps; for example, if Ps=42, then grep's expression will be: "in42".

    If $Ps is a value that contains whitespace, this will be split into words (as the expansion is unquoted) and it would break the command. The resulting string would also undergo filename globbing if any wildcard characters (such as *) is present in $Ps.

    My best guess is that it's a reference to using PowerShell in VBScript.

  • As Stéphane said, the ** is an extended globbing syntax, which here is used twice, in order to pull up all of the files ending in .asp and .js from within the current directory as well as from subdirectories (recursively) as ones for grep to search through. It is used by the shell, not by grep.

Long story short, the code will display file names and corresponding line numbers for lines that match \"in\", where in is followed by whatever value $Ps holds.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.