Skip to content

Instantly share code, notes, and snippets.

@rajivmehtaflex
Created January 13, 2025 09:49
Show Gist options
  • Save rajivmehtaflex/799207413a1da7517c0af964ebd686a0 to your computer and use it in GitHub Desktop.
Save rajivmehtaflex/799207413a1da7517c0af964ebd686a0 to your computer and use it in GitHub Desktop.
Rust based Ops
#!/bin/bash
# Set errexit to exit immediately if a command exits with a non-zero status
set -e
# Print a message indicating the start of the script
echo "Starting Rust installation script..."
# Download and execute the rustup installer
echo "Downloading and executing rustup installer..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Source the environment variables
echo "Sourcing environment variables..."
source "$HOME/.cargo/env"
# Verify the installation by checking the rust version
echo "Verifying installation..."
rustc --version
rustup --version
cargo --version
# Print a success message
echo "Rust installation complete!"
# Optional: Example of creating and running a simple rust program
echo "Creating and running a simple Rust program..."
cargo new hello_world_test
cd hello_world_test
cargo run
echo "Script completed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment