Except for the parts involving Github, the homework should be done using only the command line, i.e. git-bash for the windows users and the terminal for the linux and macOS users.
- Using github, fork this repository
- Using the command line, create a directory named potatoe, and enter the directory
- Using the command line, clone the repository that you just forked
- Using git, create a branch named
yourfirstName_yourlastName
and move to that branch (hint: typegit branch
to see in which branch you are) - Use VIM (in the command line) to write ONE shell script named
yourfirstName_yourlastName.sh
to do following:- Create a directory named cabbage
- Enter the directory cabbage
- Check the path for the directory where you are
- Create an empty file named orange.txt
- Write the content "Hello" five times to the file orange.txt
- Copy the file orange.txt and paste its contents into 1.txt, 2.txt, 3.txt, 4.txt and 5.txt
- Write the text "cat" to pets.txt
- Append the text "dog" to pets.txt
- Append the text "hamster" to pets.txt
- Check the contents of the file pets.txt
- Check the contents of the directory where you are
- Use git to commit your shell script
- Use git to push the changes in your branch to your hyf_cli_git_homework repository on github
- Do a pull request to merge your script
yourfirstName_yourlastName.sh
into this repository
Finally, run the script and make sure the directory and the files were created as expected, but do NOT track the files and folders created with git.
Tips:
- useful command line commands:
cd
,pwd
,mkdir
,>
,ls
,>>
,cat
,cp
- useful git commands:
git init
,git clone <URL>
,git checkout -b branch_name
,git add
,git commit
,git push
- a shell script should have the extension .sh
- to run a shell script use
sh file_name.sh
- useful VIM commands: save and exit:
:wq
; exit without saving::q!
; start insert mode:i
; start command mode; pressESC