Question 1
You are working on a C project and need to scaffold a base project skeleton.
Write a script scaffold.sh that creates the following filesystem structure:
include/
└── my_project/
└── config.h
src/
├── main.c
└── config/
├── config.debug.h
├── config.release.h
└── config.h -> config.release.h
tests/
The script should take one command-line argument, which can be either debug or release. Depending on the argument, the config.h symbolic link should point to the corresponding configuration file:
debug→config.debug.hrelease→config.release.h
For example, ./scaffold.sh debug should result in src/config/config.h -> config.debug.h, and ./scaffold.sh release should result in src/config/config.h -> config.release.h.
The script should create all required directories and files.
Instructions
- Write your script in
scaffold.sh. It will be given the command line argumentdebugorreleaseand should use it to create the symlink. - It should create the files and folders in the current directory.
- Files can be empty files.
- If the link is not correctly created, the test fails and no marks are given. There are no partial marks.
Hints
- Symlinks store the path relative to the link itself.
The test lists what your script created, with -> after each symlink.