خرید بک لینک

I want to write a unix/linux script „updategit.sh“ with a default parameter to commit to git. „updategit.sh“ should be POSIX compatible. I hope POSIX will solves some of worst incompatibilities of the unix/linux shells.

Syntax: updategit.sh {$1}

{$1} means the parameter $1 is optional.

1) If no parameter is passed to “updategit.sh” the last action in the script should be:

git commit -m 'Patches #1023, #1016.4 .. .17 reapplied. See e-mail from Paul (paul@sh.ts) send at 2016-01-26 08:56'

Is it enough to pass it in single quotes when the text does not contain a single quote?

2) It should be possible to pass an optional parameter $1 to „updategit.sh“. The natural syntax would be to enclose the parameter in double quotes. I think that will not be possible. I want to able to get as much as possible to „updategit.sh“ without the shell destroying the input parameter and the command to fail because of the shell messing with the input.

The natural systax would be something like this:

$ ./updategit.sh „New template GetShape()“ $ ./updategit.sh „Patch #312.5 applied. See Eve's email (eve@stoneage.nix) from 2016-02.29 09:43“ $ ./updategit.sh „Round to .5 fixed“ $ ./updategit.sh

It is clear that the shell will mess with input. How near could I come to the „natural“ syntax without git commit -m $1 to fail? AFAIK the command “git commit -m $1” must be rewritten to something more robust.

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 14 اسفند 1394 ساعت: 9:46

صفحه بندی