LoginSignup
0
0

More than 1 year has passed since last update.

【初心者向け】Rubyでコマンドラインツールを作る

Posted at

hello.rb というファイルを作ってみてください
中身は puts "world" です
これを ruby hello.rb で実行してみてください

% ruby hello.rb
world

となりますね。

そうしたら

#!/usr/bin/env ruby
puts "world"

に変更してくてみださい。
ファイル名も hello.rb から hello に変更します。

./hello で実行してみましょう。

% ./hello
-bash: ./hello: Permission denied

このようなエラーが出ます。
実行する権限がないので追加します。

% chmod +x ./hello

再実行します。

% ./hello
world

おわりです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0