exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

README.md (2105B)


      1 # Two Fer
      2 
      3 `Two-fer` or `2-fer` is short for two for one. One for you and one for me.
      4 
      5 Given a name, return a string with the message:
      6 
      7 ```text
      8 One for X, one for me.
      9 ```
     10 
     11 Where X is the given name.
     12 
     13 However, if the name is missing, return the string:
     14 
     15 ```text
     16 One for you, one for me.
     17 ```
     18 
     19 Here are some examples:
     20 
     21 |Name    |String to return 
     22 |:-------|:------------------
     23 |Alice   |One for Alice, one for me. 
     24 |Bob     |One for Bob, one for me.
     25 |        |One for you, one for me.
     26 |Zaphod  |One for Zaphod, one for me.
     27 
     28 
     29 Run the tests with:
     30 
     31 ```bash
     32 bats two_fer_test.sh
     33 ```
     34 
     35 After the first test(s) pass, continue by commenting out or removing the
     36 `[[ $BATS_RUN_SKIPPED == true ]] || skip` 
     37 annotations prepending other tests.
     38 
     39 To run all tests, including the ones with `skip` annotations, run:
     40 
     41 ```bash
     42 BATS_RUN_SKIPPED=true bats two_fer_test.sh
     43 ```
     44 
     45 ## Source
     46 
     47 [https://github.com/exercism/problem-specifications/issues/757](https://github.com/exercism/problem-specifications/issues/757)
     48 
     49 
     50 ## External utilities
     51 `Bash` is a language to write "scripts" -- programs that can call
     52 external tools, such as
     53 [`sed`](https://www.gnu.org/software/sed/),
     54 [`awk`](https://www.gnu.org/software/gawk/),
     55 [`date`](https://www.gnu.org/software/coreutils/manual/html_node/date-invocation.html)
     56 and even programs written in other programming languages, 
     57 like [`Python`](https://www.python.org/).
     58 This track does not restrict the usage of these utilities, and as long
     59 as your solution is portable between systems and does not require
     60 installation of third party applications, feel free to use them to solve
     61 the exercise.
     62 
     63 For an extra challenge, if you would like to have a better understanding
     64 of the language, try to re-implement the solution in pure `Bash`,
     65 without using any external tools. Note that there are some types of
     66 problems that bash cannot solve, such as performing floating point
     67 arithmetic and manipulating dates: for those, you must call out to an
     68 external tool.
     69 
     70 ## Submitting Incomplete Solutions
     71 It's possible to submit an incomplete solution so you can see how others
     72 have completed the exercise.