1

I have a win7 machine and I use Git Shell (which seems to be Windows Powershell)

I am trying to follow the Lab 3 tutorial of GIT IMMERSION (http://gitimmersion.com/lab_03.html).

I do not know how to create a file named hello.rb with the contents below.

puts "Hello, World"

Any help is appreciated. Many thanks!

ℕʘʘḆḽḘ
  • 18,566
  • 34
  • 128
  • 235
  • Unless I'm missing something, can't you just paste that line into Notepad and save the file in the appropriate place? – alroc Jul 28 '14 at 14:14

2 Answers2

2

If it's Powershell, then use Set-Content

Set-Content hello.rb 'puts "Hello, World"'
Mike Zboray
  • 39,828
  • 3
  • 90
  • 122
  • 1
    How is this the correct answer? It doesn't work in the git shell. –  Jul 27 '14 at 19:34
  • 2
    @Swonkie The "Git Shell" for provided by GitHub for Windows is [configurable](http://haacked.com/archive/2012/05/21/introducing-github-for-windows.aspx/) to use the shell of your choice. The OP indicated it was probably Powershell, so that is what I used for the answer. – Mike Zboray Jul 27 '14 at 19:40
  • 1
    Ah I see. Didn't know about the version from GitHub. I still prefer my solution, since it works in pretty much any shell (even PowerShell). –  Jul 27 '14 at 19:42
  • 1
    @Swonkie Git Shell is configurable to use Git Bash, but the default shell is Powershell. – Mike Zboray Jul 27 '14 at 19:44
1

The Git Shell is bash, not PowerShell.

echo 'puts "Hello, World"' > hello.rb
  • 1
    You need to remove the single quotes. That's not what he wanted :) – Frode F. Jul 27 '14 at 19:27
  • 1
    Yes, they are required - they won't end up in the file. –  Jul 27 '14 at 19:29
  • 1
    It's not clear that it is bash. If you install GitHub for Windows, for example, it creates a "Git Shell" link which is powershell with git commands added to your path. – Mike Zboray Jul 27 '14 at 19:31
  • 1
    It says "Git Bash" in the title of the window when I open git shell on my Windows 7 machine. The value of $BASH_VERSION is 3.1.0(1)-release –  Jul 27 '14 at 19:33