-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell_variables.sh
More file actions
executable file
·42 lines (37 loc) · 951 Bytes
/
shell_variables.sh
File metadata and controls
executable file
·42 lines (37 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/bash
clear
echo "{{ USEFUL SPECIAL SHELL VARIALBLES }}"
echo -e "\
# For EXIT_STATUS $? is special variable
# each program return 0 on sucess and other on unsuccess execuons"
date
echo $?
echo -e "\
# return 0 due to sucessfull execution of date"
date -z
echo $?
echo -e "\
# non 0 for unsucessl execution"
echo -e "\
total no. of terminal argument \$# valiable : $#"
echo -e "\
total arguments passed to it ==> $*"
echo -e "\
0st argument \$0==> $0 <== itself file name
1nd argument \$1==> $1
2rd argument \$2==> $2
3rd argument \$3==> $3
all ogf them are \$@ or \$* ==> $@ or $*
Option supplied to shell \$- ==> $-
PID of shell \$$ ==> $$
PID of last started process \$! ==> $!"
echo -e "
---------------------------------------------------
"
RED='\033[0;31m'
NC='\033[0m' # No Color
printf "I ${RED}love${NC} Stack Overflow\n"
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo "${red}red text ${green}green text${reset}"