Sha1sum auf git-bash installieren (MinGW)

4466
mcgyver5

Ich habe viel unter git-bashWindows 7 verwendet. Ich finde, es ist ein Wrapper von MinGW. Es hat md5sum, aber nicht sha1sum . Ich würde gerne installieren sha1sum, aber ich weiß nicht wie.

Wenn ich es versuche mingw-get, sagt es "Befehl nicht gefunden"

Als ich versuchte, mingw-getvon SourceForge herunterzuladen, fand ich nur ein Installationsprogramm für das gesamte MinGW-Programm, aber nicht für mingw-get.

Wie installiere ich entweder get sha1sumoder get mingw-get?

5

2 Antworten auf die Frage

6
Steven Penny

mingw-get ist verfügbar bei

sourceforge.net/projects/mingw/files/Installer/mingw-get

Nachdem Sie diesen installiert haben, laufen Sie

mingw-get install msys-coreutils

Vielen Dank für Ihre Antwort. Ich habe es heruntergeladen und das Installationsprogramm ausgeführt. Leider ist dies das Ergebnis: Willkommen bei Git (Version 1.7.4-preview20110204) McGuiT1 @ ISTM-L-6328MJ1 ~ $ mingw-get install mysys-coreutils sh.exe ": mingw-get: Befehl nicht gefunden mcgyver5 vor 12 Jahren 0
Sie müssen mingw-get zu Ihrem Pfad http://wikipedia.org/wiki/PATH_%28variable%29 hinzufügen Steven Penny vor 12 Jahren 1
Update: Ich habe mingw-get und msys-coreutils erfolgreich installiert, aber der Befehl sha1sum wurde immer noch nicht gefunden mcgyver5 vor 10 Jahren 1
1
thetabit

Ich löste das Problem für mich, indem ich eine Shell-Funktion hinzufügte, die das mitgelieferte openssl verwendet, um den am häufigsten verwendeten Teil von sha1sum zu ersetzen.

function openssl_sha1sum() { local i nf=0 binary= text=true local -a files  # parse for -b/-t mode output arguments for (( i=1; i <= $#; i++ )); do case "${!i}" in (-t|--text) text=true binary= ;; (-b|--binary) binary=true text= ;; (-|-[cw]|--help|--version|--status|--check|--warn) ;; (*) let 'nf++' files[$nf]="${!i}" ;; esac done  # execute the appropriate command and reformat the output if [ $nf -eq 0 ]; then local binfmt='s/$/ *-/;' txtfmt='s/$/ -/;' if [ -n "$binary" ]; then fmt=$binfmt else fmt=$txtfmt fi openssl dgst -sha1 -hex | sed -e "$fmt" else local commonfmt='s/^[A-Z0-9]\+(\(.*\))= \([0-9a-fA-F]\+\)$/\2' local binfmt="$commonfmt "'*\1/;' txtfmt="$commonfmt "'\1/;' if [ -n "$binary" ]; then fmt=$binfmt else fmt=$txtfmt fi openssl dgst -sha1 -hex "$" | sed -e "$fmt" fi }  if ! type -p sha1sum &>/dev/null; then function sha1sum() { openssl_sha1sum "$@"; } fi