- Get access to your .bashrc file. If you don't have one, create it.
If you're using "scoop", you should find it in
C:\Users\YOUR_USER_NAME\scoop\apps\git\current\etc\bash.bashrc
, if installed with Gitbash directly, it should be inC:\Program Files\Git\etc\bash.bashrc
. - Add the "fortune" folder where it suits you. You can find it in this repository.
- Add the "fortune" function to your .bashrc file. You can find it in the bash.bashrc file in this repository.
- Replace the
C:/here/is/the/path/to/your/.json/file/fortune.json
line from the bash.bashrc file with the path to your fortune.json file (the file inside the folder from step 2). - Save the .bashrc file and restart Gitbash.
- Open Gitbash.
- Type
fortune
and press enter. - Enjoy your quote.
-
The fortunes are in English. If you want to translate them, you can do it in the fortune.json file.
-
The fortunes file contains +5000 thousands quotes.
-
For more fun, you can combine the fortune command with the cowsay command. You need to install the
cowsay
program before. You can do it using the "scoop" program. you can find it here: Scoop for Windows. Once installed, just typescoop install cowsay
and press enter. Then, you can typefortune | cowsay
and press enter. -
If you want to get a fortune quote when opening Gitbash, you can uncomment the
fortune
command to the end of the .bashrc file by removing the # character. Ditto for the automation of the cowsay command.
Thanks to James F Thompson for the json file and the +5000 quotes.