
Am reuşit cu ceva timp în urmă să conving un amic să facă “marea trecere” ( de la windows la ubuntu ) şi normal că prima lui preocupare a fost să-l “tuneze” cum ar spune el. A început să caute poze cu fluxbox , compiz , etc.
A găsit pe deviantart o poză a unui terminal dar mai “special”. Se pare că tipul respectiv avea instalat fortune şi normal că eu a trebuit să explic cum să facă şi el la fel, de aici şi articolul.
Ce este fortune ?
Fortune este o micuţă aplicaţie care atunci când este executată afişează citate la întâmplare ( random quotes ) folosind o bază de date ( /usr/share/games/fortune ) .
kabron@laptop:~$ fortune
He who opens a school door, closes a prison.
— Victor Hugo
(random quotes sau citate la intamplare )
Cum instalăm ? ( ubuntu )
sudo apt-get install fortune
Cum facem că aplicaţia să ruleze automat atunci când deschidem terminalul ?Nimic mai simplu, căutăm .bash_profile sau .bashrc ( dir. /home/ creaţi dacă nu există ) şi adăugăm “fortune” la sfârşitul acestuia.
Cum facem ca fortune să afişeze doar ce citate vrem noi sau doar despre un anumit subiect ?Presupunem că dorim doar citate ce aparţin lui Einstein.
Folosim :
” vim einstein ” şi adăugăm ce citate dorim . ex :
“Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.”
%
“Imagination is more important than knowledge.”
%
“Gravitation is not responsible for people falling in love.”
%
“I want to know God’s thoughts; the rest are details.”
%
“The hardest thing in the world to understand is the income tax.”
%
“Reality is merely an illusion, albeit a very persistent one.”
%
“The only real valuable thing is intuition.”
%
“A person starts to live when he can live outside himself.”
%
“I am convinced that He (God) does not play dice.”
%
“God is subtle but he is not malicious.”
%
“Weakness of attitude becomes weakness of character.”
%
“I never think of the future. It comes soon enough.”
%
“The eternal mystery of the world is its comprehensibility.”
%
“Sometimes one pays most for the things one gets for nothing.”Toate sunt separate de % !
Acum după ce avem fişierul einstein cu citatele dorite salvăm. ( nu salvaţi .txt sau .doc , doar einstein )In continuare avem nevoie de einstein.dat, pentru asta folosim :
kabron@laptop:~$ strfile einstein
“einstein.dat” created
There were 14 strings
Longest string: 168 bytes
Shortest string: 41 bytesAcum tot ce mai trebuie să facem este să mutam ambele fişiere în /usr/share/games/fortunes/
kabron@laptop:~$ sudo mv einstein /usr/share/games/fortunes/
[sudo] password for kabron:
kabron@laptop:~$ sudo mv einstein.dat /usr/share/games/fortunes/Rezultatul :
kabron@laptop:~$ fortune einstein
“Imagination is more important than knowledge.”