Skip to content

Create a script: Hello World using variables

Updated 1 min read

Updated: 11 October 2026 · Applies to: AlmaLinux 9, Rocky Linux 9, Ubuntu 24.04 and Debian 12

A first Bash script that uses a variable.

Steps

  1. Create hello.sh:
    #!/usr/bin/env bash
    name="World"
    echo "Hello, $name!"
  2. Make it executable: chmod +x hello.sh.
  3. Run it: ./hello.sh.

Tip: Quote variables ("$name") so values with spaces work correctly.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket