Files
shell-scripts/localusers/luser-demo01.sh
T
2026-09-24 12:40:30 +01:00

40 lines
755 B
Bash
Executable File

#!/bin/bash
# This script displays various information to the screen.
# Display 'Hello'
echo 'Hello'
# Assign a value to a variable.
WORD='script'
# Display that value using a variable.
echo "$WORD"
# Demonstrate that single quotes cause variable to NOT get expanded.
echo '$WORD'
# combine the variable with a hard-coded sentence
echo "this is a shell $WORD"
# Display the contents of a variable with alternative syntx
echo "This is a shell ${WORD}"
# append text to variable
echo "${WORD}ing is super fun!"
# how to NOT append text to a variable
echo "$WORDing is super fun!"
# Assign new variable
ENDING='ed'
# concat two variables
echo "This is ${WORD}${ENDING}"
# Reassign value of variable
ENDING='ing'
echo "This is ${WORD}${ENDING}"