From bd76890b65e2805802eb24cc4ecceba057a01f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartal=20L=C3=A6arsson?= Date: Thu, 24 Sep 2026 12:40:30 +0100 Subject: [PATCH] basic vars --- localusers/luser-demo01.sh | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 localusers/luser-demo01.sh diff --git a/localusers/luser-demo01.sh b/localusers/luser-demo01.sh new file mode 100755 index 0000000..006eb0a --- /dev/null +++ b/localusers/luser-demo01.sh @@ -0,0 +1,39 @@ +#!/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}"