This option works, but there are no hyphenation in the final file, all in one line. How to add hyphenation?
echo $(git ls-tree -r dev --name-only) > filesUnderGit.txt git ls-tree -r master --name-only > test.txt As with any other command that writes to stdout . And as with any such command, you can do a pipe-train, if you want to somehow handle the output stream.
git ls-tree -r master --name-only | grep "some/path" | head 42 > test.txt Here we take only the files lying in some/path , and then leave the first 42 of them.
this design:
$ echo $(git ...) somewhat "overloaded."
conditionally it can be represented as:
$ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ° $(ΠΊΠΎΠΌΠ°Π½Π΄Π°) First, a ΠΊΠΎΠΌΠ°Π½Π΄Π° is executed that is enclosed within the βshellβ (from the word shell , shell) operator $() .
then its output (no matter if it contains one line or more) is converted to one line (line characters are replaced with spaces) to pass to the ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ΅ as a set of parameters (not options!).
that's why it comes out "all in one line."
in this particular case, such a conversion can be avoided quite simply - it is enough to remove echo and the $() operator - as unnecessary:
$ ΠΊΠΎΠΌΠ°Π½Π΄Π° but there can be such a situation as the program and the operator are needed, but it is required that there should be no βone-line conversionβ. to avoid this is also not difficult - it is enough to put (double) quotes βin the wayβ between executing the $() operator and forming the parameter string for the ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ . like that:
$ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ° "$(ΠΊΠΎΠΌΠ°Π½Π΄Π°)" Source: https://ru.stackoverflow.com/questions/469583/
All Articles