Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Write a Bash script in Redhat linux.

#!/bin/bash

echo "what is your name"

read USER

echo "Hello, $USER"

********************

NAME="abc" #scale out variable.

echo $NAME

NAME="abc" #readonly variabale

readonly NAME

NAME="xyz"

NAME="abc" #UNSET variabale

unset NAME

echo $NAME

************

special variable...

#$0 = filename of script

$1...9 = corsspoing argument

$# = read the no. of argument

$* = all the argument dobule quoted

$@ = double quoted individul


$? = exit stautus

example

echo "file name: $0"

echo "first parameter: $1"

echo "second parameter: $2"

echo "quoted value: $@"

echo "quoted vlaue: $*"

echo "no of parameter: $#"

You might also like