### Script Usage Example Source: https://context7.com/cowsay-org/cowsay/llms.txt Integrate cowsay into shell scripts to provide friendly status messages during execution, such as before starting a process or after completion. ```bash #!/bin/bash # deploy.sh - A deployment script with personality cowsay -f dragon "Starting deployment..." if ./run-tests.sh; then cowsay "All tests passed!" ./deploy-to-production.sh cowsay -f stegosaurus "Deployment complete!" else cowsay -d "Tests failed. Deployment aborted." exit 1 fi ``` -------------------------------- ### Install Cowsay using Make Source: https://github.com/cowsay-org/cowsay/blob/main/README.md Standard installation method for Cowsay using the make utility. Specify a custom prefix if needed. ```bash make install ``` ```bash make install prefix=/path/to/installation/prefix ``` -------------------------------- ### Install Cowsay using Homebrew Source: https://github.com/cowsay-org/cowsay/blob/main/README.md Installs Cowsay on macOS and Linux systems using the Homebrew package manager. ```bash brew install cowsay ``` -------------------------------- ### List Available Cowfiles Source: https://context7.com/cowsay-org/cowsay/llms.txt Display all installed cow characters using the -l flag. ```bash # Human-readable format (when output is a terminal) cowsay -l # Output: # Cow files in /usr/local/share/cowsay/cows: # actually alpaca beavis.zen bill blowfish bong bud-frogs bunny chami # cheese cower cupcake daemon default dragon dragon-and-cow elephant # elephant-in-snake eyes flaming-sheep fox ghostbusters head-in # hellokitty kiss kitty koala kosh llama luke-koala mech-and-cow meow # milk moofasa moose mutilated ren sans sheep skeleton small stegosaurus # stimpy supermilker surgery sus three-eyes turkey turtle tux udder # vader vader-koala www # Parseable format (when piped or redirected) cowsay -l | head -5 # Output (one cow per line): # actually # alpaca # beavis.zen # bill # blowfish ``` -------------------------------- ### Piping and Redirection with Cowsay Source: https://context7.com/cowsay-org/cowsay/llms.txt Use cowsay with standard Unix pipes and redirection to capture output to files or process data streams. This example pipes syslog data through cowsay. ```bash # Capture output to a file cowsay "Saved message" > moo.txt ``` ```bash # Use in a pipeline cat /var/log/syslog | tail -1 | cowsay ``` ```bash # Combine with other text utilities echo "IMPORTANT" | tr '[:lower:]' '[:upper:]' | cowsay -f daemon ``` -------------------------------- ### Shell Integration for Login Messages Source: https://context7.com/cowsay-org/cowsay/llms.txt Add cowsay to shell configuration files like .bashrc or .zshrc for dynamic login greetings. This example uses fortune and a random cow. ```bash if command -v cowsay &> /dev/null && command -v fortune &> /dev/null; then fortune | cowsay -f $(cowsay -l | shuf -n 1) fi ``` -------------------------------- ### System-Wide Cowpath Configuration Source: https://context7.com/cowsay-org/cowsay/llms.txt Administrators can add system-wide cowfile search paths by creating .path files in the cowpath.d directory. ```bash # File: /etc/cowsay/cowpath.d/extra-cows.path # (or /usr/local/etc/cowsay/cowpath.d/extra-cows.path for non-/usr prefixes) # Contents - one directory path per line: /opt/extra-cows/animals /opt/extra-cows/characters ``` -------------------------------- ### Open Development for Next Release Source: https://github.com/cowsay-org/cowsay/blob/main/doc-project/Release Checklist.md Prepares the project for the next development cycle by updating version numbers and rebuilding man pages. This is typically done for major or minor releases. ```bash make man ``` -------------------------------- ### Homebrew License Configuration Source: https://github.com/cowsay-org/cowsay/blob/main/doc-project/Licensing.md A configuration snippet representing the Homebrew maintainers' interpretation of the project's license. ```license any_of: ["Artistic-1.0-Perl", "GPL-1.0-or-later"] ``` -------------------------------- ### Exercise All Cows Source: https://github.com/cowsay-org/cowsay/blob/main/doc-project/Release Checklist.md Iterates through all available cowsay characters and displays their output. This is useful for testing the functionality of each cow. ```bash for cow in $(cowsay -l); do echo "${cow}:"; cowsay -f "$cow" moo; echo ''; done ``` -------------------------------- ### GPLv3 ChangeLog Entry Source: https://github.com/cowsay-org/cowsay/blob/main/doc-project/Licensing.md A snippet from the project ChangeLog indicating a shift to GPLv3 licensing. ```text - Licensing terms have changed to GPLv3. ``` -------------------------------- ### MOTD Script with Cowsay Source: https://context7.com/cowsay-org/cowsay/llms.txt Create a Message of the Day (MOTD) script that uses cowsay to display system information like hostname and uptime with different cow characters. ```bash #!/bin/bash echo "Welcome to $(hostname)!" | cowsay -f tux uptime | cowsay -f small ``` -------------------------------- ### Git Tagging a Release Source: https://github.com/cowsay-org/cowsay/blob/main/doc-project/Release Checklist.md Tags a specific release version in git. Ensure the tag format is 'vX.Y.Z'. ```bash git tag vX.Y.Z ``` -------------------------------- ### Create a Simple Custom Cowfile Source: https://context7.com/cowsay-org/cowsay/llms.txt Define a custom cowfile by assigning ASCII art to the $the_cow variable within a Perl code block. Ensure the file has a .cow extension. ```perl # File: my-cow.cow # A simple custom cow $the_cow = <<"EOC"; $thoughts ^__^ $thoughts ($eyes)\\_______ (__)\\ )\/\ $tongue ||----w | || || EOC ``` -------------------------------- ### Display Messages with Cowsay Source: https://context7.com/cowsay-org/cowsay/llms.txt Render text in a speech bubble using the default cow character via command-line arguments or standard input. ```bash # Message from command line arguments cowsay "Hello, World!" # Output: # _______________ # < Hello, World! > # --------------- # \ ^__^ # \ (oo)\_______ # (__)\ )\/ # ||----w | # || || # Message from stdin echo "Moo!" | cowsay # Multi-line messages are automatically word-wrapped at 40 columns cowsay "This is a longer message that will be automatically wrapped to fit within the default column width" ``` -------------------------------- ### Cowfile Creation Rules Source: https://context7.com/cowsay-org/cowsay/llms.txt Follow these rules for creating cowfiles: double backslashes, escape special characters (@, $, &), use the .cow extension, and test with `cowsay -f`. ```perl # File: escaped.cow # Rules for cowfile creation: # 1. Backslashes must be doubled $the_cow = <<"EOC"; $thoughts $thoughts /\ / \ <- This requires: /\\ /----\ in the actual file: / \\ EOC # 2. Special characters must be escaped # Escape @ $ and & with backslashes: # \@ \$ \& # 3. File must end with .cow extension to be recognized # 4. Test your cowfile: # cowsay -f /path/to/your/custom.cow "Test message" ``` -------------------------------- ### Configure COWPATH Environment Variable Source: https://context7.com/cowsay-org/cowsay/llms.txt Set the COWPATH environment variable to specify custom directories for cowfiles. Use COWSAY_ONLY_COWPATH to exclusively use these paths. ```bash export COWPATH="/home/user/my-cows:/opt/extra-cows" ``` ```bash cowsay -l ``` ```bash export COWSAY_ONLY_COWPATH=1 ``` ```bash export COWPATH="/home/user/my-cows" ``` ```bash cowsay -f mycow "Only searches my directory" ``` -------------------------------- ### Select Cow Characters Source: https://context7.com/cowsay-org/cowsay/llms.txt Change the displayed character using the -f flag followed by the cowfile name or path. ```bash # Use the Tux (Linux penguin) cow cowsay -f tux "Linux rules!" # Output: # ______________ # < Linux rules! > # -------------- # \ # \ # .--. # |o_o | # |:_/ | # // \ \ # (| | ) # /'\_ _/`\ # \___)=(___/ # Use a dragon cowsay -f dragon "Fear me!" # Use a specific cowfile path cowsay -f /path/to/custom.cow "Custom cow!" ``` -------------------------------- ### Fortune Cookie Integration Source: https://context7.com/cowsay-org/cowsay/llms.txt Combine cowsay with the 'fortune' command to display random quotes. Options include random cows (-r) and dead cows (-d). ```bash fortune | cowsay ``` ```bash fortune | cowsay -r ``` ```bash fortune -o | cowsay -d ``` -------------------------------- ### Custom Cowfile with Variables Source: https://context7.com/cowsay-org/cowsay/llms.txt Utilize special variables like $thoughts, $eyes, and $tongue within a cowfile to allow for dynamic customization of the cow's appearance. ```perl # File: robot.cow # Available variables: # $thoughts - The trail leading to the speech bubble (\ or o) # $eyes - Two-character eye string (default: oo) # $tongue - Two-character tongue string (default: two spaces) $the_cow = <<"EOC"; $thoughts $thoughts ___ [o_o] <- uses $eyes here would be: [$eyes] |___| /| |\ | | |_ EOC ``` -------------------------------- ### Apply Emotional Modes Source: https://context7.com/cowsay-org/cowsay/llms.txt Modify the cow's appearance using preset emotional flags. ```bash # Borg mode - robotic eyes (==) cowsay -b "Resistance is futile" # Dead mode - X eyes and tongue out (xx, U) cowsay -d "I'm not feeling well..." # Greedy mode - dollar sign eyes ($$) cowsay -g "Show me the money!" # Paranoid mode - at-sign eyes (@@) cowsay -p "They're watching me..." # Stoned mode - star eyes and tongue (**, U) cowsay -s "Whoa dude..." # Tired mode - dash eyes (--) cowsay -t "So sleepy..." # Wired mode - wide eyes (OO) cowsay -w "TOO MUCH COFFEE!" # Young mode - dot eyes (..) cowsay -y "I'm just a calf" ``` -------------------------------- ### Original Cowsay License Statement Source: https://github.com/cowsay-org/cowsay/blob/main/doc-project/Licensing.md The initial licensing terms for Cowsay, which mirrored the Perl licensing model. ```text cowsay is distributed under the same licensing terms as Perl: the Artistic License or the GNU General Public License. If you don't want to track down these licenses and read them for yourself, use the parts that I'd prefer[...] ``` -------------------------------- ### Display Messages with Cowthink Source: https://context7.com/cowsay-org/cowsay/llms.txt Use the cowthink command to render text in a thought bubble instead of a speech bubble. ```bash cowthink "I wonder what's for dinner..." # Output: # ________________________________ # ( I wonder what's for dinner... ) # -------------------------------- # o ^__^ # o (oo)\_______ # (__)\ )\/ # ||----w | # || || ``` -------------------------------- ### Custom Wrap Width with -W Source: https://context7.com/cowsay-org/cowsay/llms.txt Control the column width at which text wraps using the -W flag. Specify the desired column number. ```bash cowsay -W 20 "This message will wrap at a narrower width than the default" ``` ```bash cowsay -W 60 "This message has more room before wrapping occurs" ``` -------------------------------- ### Select Random Cow Source: https://context7.com/cowsay-org/cowsay/llms.txt Use the -r flag to select a random character, with an optional -C flag to include truecolor cows. ```bash # Select a random cow (excludes truecolor cows by default) cowsay -r "Surprise!" # Include truecolor (24-bit color) cows in random selection cowsay -r -C "Full color surprise!" ``` -------------------------------- ### Combine Custom Eyes and Tongue Source: https://context7.com/cowsay-org/cowsay/llms.txt Use the -e and -T flags to specify custom eyes and tongue characters for the cow's expression. ```bash cowsay -e "< >" -T "~ /" "Confused and silly" ``` -------------------------------- ### Customize Eyes and Tongue Source: https://context7.com/cowsay-org/cowsay/llms.txt Manually define the eye and tongue characters using the -e and -T flags. ```bash # Custom eyes (first two characters of the string are used) cowsay -e "^^" "Happy cow!" # Custom tongue (two character string) cowsay -T "U " "Sticking out tongue" ``` -------------------------------- ### Disable Word Wrapping with -n Source: https://context7.com/cowsay-org/cowsay/llms.txt Use the -n flag to disable word wrapping, preserving pre-formatted text like ASCII art. This is often used with figlet. ```bash figlet "MOO" | cowsay -n ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.