https://www.youtube.com/watch?v=tK9Oc6AEnR4&ab_channel=freeCodeCamp.org
-
Create file
vim textfile.txt
a. Type
i
to enterInsert
mode
b. EnterHello World!
c. Hitesc
, then enter:qw
to write and quit
d. Output filecat textfile.txt
-
Create file
vim shellscript.sh
a. Type
a
to enterAppend
mode, which outputs character after cursor
b. Enterecho Hello World!
c. Hitesc
, then enter:qw
to write and quit
d. Run scriptzsh [shelltest.sh](http://shelltest.sh)
orbash shelltest.sh
-
Modify file
vim shellscript.sh
#!/bin/zsh echo Hello World!
a. modify permissions
chmod u+x shellscript.sh
b. Run script./shellscript.sh
#!/bin/zsh
## BAD
cp /my/location/from /my/location/to
cp /my/location/from/here /my/location/to/there
## GOOD
MY_LOCATION_FROM=/my/location/from
MY_LOCATION_TO=/my/location/to
cp $MY_LOCATION_FROM $MY_LOCATION_TO
cp "$MY_LOCATION_FROM" "$MY_LOCATION_TO"
-
Create file
vim hellothere.sh
#!/bin/zsh FIRST_NAME=Abraham LAST_NAME=Choi echo Hello $FIRST_NAME $LAST_NAME
a. modify permissions
chmod u+x hellothere.sh
b. Run script./hellothere.sh
-
Create file
vim interactive.sh
#!/bin/zsh echo "What is your first name?" read FIRST_NAME echo "What is your last name?" read LAST_NAME echo Hello $FIRST_NAME $LAST_NAME
a. modify permissions
chmod u+x interactive.sh
b. Run script./interactive.sh
-
Create file
vim posargs.sh
#!/bin/zsh echo Hello $1 $2
a. modify permissions
chmod u+x posargs.sh
b. Run script./posargs.sh [ARG 1] [ARG 2]