Information Technology Reference
In-Depth Information
How It Works
The first alias creates files. The call:
$ git create-file yes no
creates two files
yes.txt
and
no.txt
. The first file contains text
yes
and the
second contains the text
no
. The
for
loop:
for name in \"$@\"; do
echo $name>$name.txt;
done;
processes all the parameters passed to the script. Every parameter is accessible in one
pass of the loop as
$name
variable. Hence the call:
$ git create-file yes no
is equivalent to:
echo yes>yes.txt
echo no>no.txt
The second alias contains the identical loop processing all the parameters:
for name in \"$@\"; do
git create-file \"$name\";
git snapshot $name;
done;
With every pass of the loop we call two aliases:
$ git create-file $name
$ git snapshot $name
The call:
$ git simple-commit yes no