Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion task-1/setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,63 @@
# Write your code here
#!/bin/bash
set -e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was not asked for in the instructions.


echo "Creating project..."

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
Comment on lines +6 to +7

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?


mkdir -p project

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -p option is superfluous here and elsewhere where you used mkdir. There are no intermediate directories to create. Mind the YAGNI principle:

a programmer should not add functionality until deemed necessary.

cd project

git init

touch README.md
mkdir -p resources
touch "resources/family picture.jpg"
touch resources/icon.png
touch resources/logo.png
touch settings.conf

mkdir -p src
touch src/program.java
mkdir -p src/profile
mkdir -p src/database

git add .
git commit -m "initial commit"

sleep 3
echo "Setup project..."


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A single blank line to separate blocks of code is customary.

echo "Welcome to my project" > README.md


rm -rf src/profile
rm -f "resources/family picture.jpg"


git add .
git commit -m "Remove profile folder and family picture"

sleep 3


ls resources

echo "Setup javascript..."

mv src/program.java src/program.js
echo "console.log('JavaScript works!');" > src/program.js


node src/program.js


git add .
git commit -m "Setup JavaScript program"


ls ~

echo "All done!"
Loading