-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargs.sh
More file actions
executable file
·41 lines (39 loc) · 1009 Bytes
/
Copy pathargs.sh
File metadata and controls
executable file
·41 lines (39 loc) · 1009 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
#!/usr/bin/bash
#
## echo "You entered the argument : $1,$2,$3"
## # $1 -> represent 1st argument and so on...
##
#
## ls -lha $1
#
#if [ -z "$1" ]; then
# echo "You need to provide an argument"
# exit 1
#fi
# lines=$((ls -lh $1) | wc -l )
# echo "You have $(($lines-1)) objects in $1 directory"
## $(($lines-1)) not doing $ outside would just return number-1 ex : (300-1) doing $() would give the answer
#
## $# - Checks the number of arguments given
## if [ $# -ne 1]; then
## echo "something"
## fi
#TODO:: Check for Global and Local Scope variables
number_finder() {
local var=$1 # Local means it has scope variables whereas declaring normal variables has global scope
var=$2
if [ -z $var ]; then
echo "Empty"
else
echo "Not Empty"
fi
}
number_finder hola
# number_finder=$1 echo "You entered the following number : $number_finder"
check() {
local sar="HOla"
echo $sar
}
check
#Local varibales are not accessible outside the scope
echo "This doesn't prints anything : $sar"