auの日記

プログラミング初心者の日記。(auはハンドルネームです)

シェルを開いた際に格言を表示する

auです。

今回は、シェルにログインした際に格言を表示することのできる「fortune-mod」を使ってみました。

今使っているのがMacなので、MacOSでの話になります。
以下のコマンドをターミナルで実行してfortuneをインストールしてください。brewをインストールしていない場合はURLからDLしてください(brewのインストール)

brew install -y fortune

インストール後に

fortune

と入力すると格言が表示されます。

Antonym, n.:
	The opposite of the word you're trying to think of.

bashrcに記述する

etcフォルダに移動します。

cd /private/etc/

ターミナルで使えるエディタのne(nice editor)をインストール

brew install ne

bashrcを開く

ne bashrc

その中に「fortune」と記述します。

ターミナルを再起動すると

Do you know the one -- "All I ask is a tall ship, and a star to steer
her by ..."  You could feel the wind at your back, about you ...  the
sounds of the sea beneath you.  And even if you take away the wind and
the water, it's still the same.  The ship is yours ... you can feel her
... and the stars are still there.
		-- Kirk, "The Ultimate Computer", stardate 4729.4

今度は長文の格言がでてきました(ランダム)