Git cpp bash

From Phobos Wiki
Revision as of 16:23, 6 March 2013 by Roland (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Elementary knowledge of GIT, BASH, C++ will be tested.

Task may be completed on any Linux distribution (recommended debian/ubuntu)

GIT

  • Save work progress in a repository
  • Use branches (help)
    • One branch for implementing bash script and another branch for c++
    • commit often, total number of commits should be 10+
    • when checking out a random revision, it should compile.
    • Branches start from master and must be merged back into master

BASH

Script 1 - Show memory usage

Script has 1 optional argument, path to meminfo file (contains current memory status). If it's not provided use /proc/meminfo

Use standard unix tools like awk, grep, sed to parse the input file.

Example of input file

cat /proc/meminfo 
MemTotal:        7969612 kB
MemFree:         4582768 kB
Buffers:          707368 kB
Cached:          1122984 kB
SwapCached:            0 kB
Active:          1742408 kB
Inactive:        1203472 kB
[ ... ]

output:

./script1.sh /proc/meminfo
RAM: 4582 MB used / 7969 MB total ( 3387 MB free)

Script 2 - compile c++ application

Compiles the C++ application Probably only has 1 useful line, g++ with some linker options.

example:

./script2.sh
Compilation started
Compilation finished

C++

List files in directory

Program takes one argument: path to directory. Outputs list of files.

Application must print out the name of directory. List all files in that directory. Each line must be preceded with the current running time of application. At the end, show total run time.

Use boost libraries: format, date_time, filesystem.

Output format:

./prog /path/to/directory
List of files in '/path/to/directory'
Time: 00:00:00.123456 file: 'filename1'
Time: 00:00:01.123456 file: 'filename2'
Time: 00:00:02.123456 file: 'filename3'
Total running time was: 00:00:10.654321