BASH | Bash Cookbook |

Using Variables in Bash

#!/bin/bash
echo "hello"
WORD='script'
echo "This is a $WORD"
echo "This ${WORD}ing a $WORD"
ENDING='ed'
echo "${WORD}$ENDING"
ENDING='s'
echo "${WORD}$ENDING"
ENDING='alicious'
echo "${WORD}$ENDING"

# Echo the exit status - notice 0 generally means success
echo ${?}

# User UID
echo ${UID}

# User name - notice the use of $() construct for a command substitution
# you could use `id -un` also

echo $(id -un)

http:///wiki/?bashvariables

22may23   admin