подбираем и массируем параметры (Pick out and massage parameters)
SQ-QUOTE
In --sq-quote
mode, git rev-parse echoes on the standard output a
single line suitable for sh
(1) eval
. This line is made by
normalizing the arguments following --sq-quote
. Nothing other
than quoting the arguments is done.
If you want command input to still be interpreted as usual by git
rev-parse before the output is shell quoted, see the --sq
option.
Example
$ cat >your-git-script.sh <<\EOF
#!/bin/sh
args=$(git rev-parse --sq-quote "$@") # quote user-supplied arguments
command="git frotz -n24 $args" # and use it inside a handcrafted
# command line
eval "$command"
EOF
$ sh your-git-script.sh "a b'c"