Reputation: 18552
I tried running this command:
git submodule --quiet foreach "echo $name"
to get all submodules' names, but it returns nothing. In Linux, it works as expected.
I am using Windows 7, git version 2.1.1 under Cygwin.
Upvotes: 2
Views: 1809
Reputation: 1645
There is no way that this worked as expected on Linux. The reason is that double quote is shell's weaker quote... which means that it allowed variable expansion. That means the shell you are typing it into will do the expansion based on your current shell, and then pass it to git. So git will see "echo ", and nothing interesting will happen. You need to use single quotes which prevents variable expansion, so that the string reaches git unmolested.
Upvotes: 0
Reputation: 1323243
Cygwin means unix-like environment.
As you can see in other git submodule foreach examples (like "Bash: Git submodule foreach?"), all those commands are using single quotes around the foreach directive (as commented by Stefan Näwe)
This thread do mention in the example:
git submodules foreach 'git config -f $toplevel/.git/config submodule.$name.ignore all'
Note the single quote (double quotes did not work from msysgit bash shell)
But as I mentioned in "git submodule foreach - Robust way to recursively commit a child module first?", with git 1.9.0+ (and commit 1c4fb13), you could also try without quotes:
git submodule --quiet foreach echo $name
As commented by Stefan Näwe, you would need to do a git submodule update --init --recursive
first, before any foreach
directive.
Upvotes: 3