Created
July 5, 2023 22:41
-
-
Save abdumu/8780da90980e098f7d28911c8395db07 to your computer and use it in GitHub Desktop.
random quote in your terminal as welcome message from thousands of quotes, using php with fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1 - you should install php in your system (apt-get install php) | |
# 2 - download (https://github.com/mubaris/motivate/blob/master/motivate/data_unique/unique_quotes.json) | |
# 3 - place unique_quotes.json in ~/.config/fish | |
# 4 - add the code below in your ~/.config/fish/config.fish | |
# 5 - enjoy. | |
function fish_greeting | |
php -r 'echo (function () { $a = json_decode(file_get_contents(\'/'$HOME'/.config/fish/unique_quotes.json\'), true)[\'data\']; $k = array_rand($a); return $a[$k][\'quote\']."\\n— ".$a[$k][\'author\']."\\n";})();'; | |
end |
Also this work for zsh I think, add to your ~/.zshrc.
php -r 'echo (function () { $a = json_decode(file_get_contents(\'/'$HOME'/.config/fish/unique_quotes.json\'), true)[\'data\']; $k = array_rand($a); return $a[$k][\'quote\']."\\n— ".$a[$k][\'author\']."\\n";})();';
I didnt try the bash/zsh versions, so try and tell me
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you wanna add it to bash, just add this to your ~/.bashrc