3 ms·
And you think the crowd on HN is crazy enough to run random "cool tricks" bash-sripts, without review in their terminal? Here is the content to review after un
by reneberlin 3y ago
And you think the crowd on HN is crazy enough to run random "cool tricks" bash-sripts, without review in their terminal?
Here is the content to review after unshortening the link:
https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh https://raw.githubusercontent.com/keroserene/rickrollrc/mast...
Whatever it does, i won't run it and i strongly advice to do the same.
chatGPT says:
This bash script is designed to play Rick Astley's song "Never Gonna Give You Up" in the terminal. It uses audio and video files of the song to provide the full experience. Here's a breakdown of what the script does:
It sets some variables, including the version of the script and the URLs for the audio and video files.
There are some color codes defined for displaying text in different colors.
The script defines a few functions: "has?" checks if a command is available, "cleanup" kills the audio process if it's running, and "quit" displays a closing message.
The "usage" function displays information about the script's usage and options.
The script processes the command-line arguments. If the argument is "help" or any variation of it, the usage information is displayed and the script exits. If the argument is "inject", it appends a command to the user's bashrc file.
The script sets up signal handlers for interrupt and exit.
The "obtainium" function is defined to fetch a URL using either curl or wget, depending on availability.
The script hides the cursor and clears the screen.
Depending on the availability of certain commands, the script fetches and plays the audio and video. On Mac OS, it uses "afplay" to play the audio; on Linux, it uses "aplay"; and on Cygwin (a Unix-like environment for Windows), it uses "play" from the "sox" package.
The script fetches the video and plays it while synchronizing the frames to match the desired frame rate.
Overall, the script is a fun way to play Rick Astley's song in the terminal, providing both audio and video components.