lehrkraefte:blc:informatik:glf4-24:bash-install

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lehrkraefte:blc:informatik:glf4-24:bash-install [2024/02/07 07:40]
Ivo Blöchliger [Installation der git-bash]
lehrkraefte:blc:informatik:glf4-24:bash-install [2024/04/03 09:23] (current)
Ivo Blöchliger [Automatisches Setup]
Line 1: Line 1:
 ====== Installation der git-bash ====== ====== Installation der git-bash ======
 +Überprüfen in ''C:\ofi'' erst, ob die git nicht schon installiert ist.
   * Legen Sie einen Ordner ''C:\ofi'' an.   * Legen Sie einen Ordner ''C:\ofi'' an.
   * Gehen auf die Seite https://git-scm.com/download/win   * Gehen auf die Seite https://git-scm.com/download/win
Line 8: Line 9:
  
  
-===== Customization ===== +===== Aliases für python und notepad ===== 
-  * Starten Sie die git-bash und geben Sie folgendes Kommando exakt so ein:+ 
 +Die Datei ''.bashrc'' wird im Laufwerk H:\ gespeichert und muss nur einmal angelegt werden. 
 + 
 +  * Starten Sie die git-bash und geben Sie folgende Kommandos in dieser Reihenfolge exakt so ein (jede Zeile ist mit <key>Enter</key> zu bestätigen).
 <code bash> <code bash>
 +cd
 notepad .bashrc notepad .bashrc
 </code> </code>
Line 19: Line 24:
 </code> </code>
   * Schliessen Sie die git-bash und starten Sie diese neu.   * Schliessen Sie die git-bash und starten Sie diese neu.
-  * Das Kommando ''notepad .bashrc'' sollte jetzt Nodepad++ öffnen (ein etwas besserer Text-Editor).+  * Zur Kontrolle können Sie sich auf der Kommandozeile die definierten aliases anzeigen lassen: 
 +<code bash> 
 +alias 
 +</code> 
 +  * Von jetzt an startet das Kommando ''notepad'' den etwas besseren Editor Notepad++.
  
 +
 +===== Automatisches Setup der Datei .bashrc =====
 +Laden Sie die Datei {{lehrkraefte:blc:informatik:glf4-24:setup-aliases.bash}} herunter und führen Sie diese wie folgt aus (nachdem Sie ins Verzeichnis navigieren, wo Sie die Datei gespeichert haben:
 +<code bash>
 +cd /h/Downloads
 +bash setup-aliases.bash
 +</code>
 +
 +====== Automatisches Setup ======
 +<code powershell ofi-setup.ps1>
 +New-Item c:\ofi -ItemType Directory -ea 0
 +if (!(Test-Path C:\ofi\PortableGit\git-bash.exe)) {
 +        if (!(Test-Path c:\ofi\PortableGit.7z.exe)) {
 +                echo "Please wait while downloading..."
 +         Invoke-WebRequest -Uri "https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/PortableGit-2.44.0-64-bit.7z.exe" -OutFile c:\ofi\PortableGit.7z.exe
 +        } else {
 +                echo "Portable git Installer is already downloaded"
 +        }
 +
 +        echo "Please click OK to install Git-Bash"
 + cd c:\ofi
 + Invoke-Expression .\PortableGit.7z.exe
 +} else {
 +        echo "Git Bash already installed!"
 +}
 +if (!(Test-Path "$env:USERPROFILE\.bashrc")) {
 + echo "alias notepad='/c/Program Files/Notepad++/notepad++.exe'" | out-file "$env:USERPROFILE\.bashrc" -encoding ASCII
 + echo "alias python='winpty /c/Programme/Anaconda/python.exe'"  | out-file "$env:USERPROFILE\.bashrc" -encoding ASCII -Append
 +        echo "Created .bashrc with aliases for notepad and python"
 +} else {
 +        echo "~/.bashrc already exists, not touching it..."
 +}
 +Invoke-Expression C:\ofi\PortableGit\git-bash.exe
 +
 +</code>
  • lehrkraefte/blc/informatik/glf4-24/bash-install.1707288012.txt.gz
  • Last modified: 2024/02/07 07:40
  • by Ivo Blöchliger