-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
10-builtins.sh
37 lines (33 loc) · 909 Bytes
/
10-builtins.sh
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
echo "
############################################
## Example 10.1: #
## let's check the 'type' of some programs #
############################################
"
type alias
type grep
type gibberishasdf # doesn't exist
type ls
alias ls='ls --color'
type ls
type type
type [
which [ # [ is both a builtin and a program
type if
type [[
echo "
#################################
## Example 10.2: #
## running a script with source #
#################################
"
echo "cd.sh changes the directory to files/ and sets a variable called PANDA. First, let's run it with cd:"
bash files/cd.sh
pwd
echo $PANDA
echo "Our directory didn't change! and the \$PANDA variable doesn't exist"
echo "Let's use 'source' instead and try it again"
source files/cd.sh
pwd
echo $PANDA
echo "now we're in a different directory and \$PANDA is set"