README.md (3244B)
1 # Hello World 2 3 The classical introductory exercise. Just say "Hello, World!". 4 5 ["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is 6 the traditional first program for beginning programming in a new language 7 or environment. 8 9 The objectives are simple: 10 11 - Write a function that returns the string "Hello, World!". 12 - Run the test suite and make sure that it succeeds. 13 - Submit your solution and check it at the website. 14 15 If everything goes well, you will be ready to fetch your first real exercise. 16 17 # Welcome to Bash! 18 19 Unlike many other languages here, bash is a bit of a special snowflake. 20 If you are on a Mac or other unix-y platform, you almost definitely 21 already have bash. In fact, anything you type into the terminal is 22 likely going through bash. 23 24 The downside to this is that there isn't much of a development 25 ecosystem around bash like there is for other languages, and there are 26 multiple versions of bash that can be frustratingly incompatible. Luckily 27 we shouldn't hit those differences for these basic examples, and if you 28 can get the tests to pass on your machine, we are doing great. 29 30 ## Installation 31 32 As mentioned above, if you are on a unix-like OS (Mac OS X, Linux, Solaris, 33 etc), you probably already have bash. 34 35 ## Testing 36 37 As there isn't much of a bash ecosystem, there also isn't really a de 38 facto leader in the bash testing area. For these examples we are using 39 [bats](https://github.com/sstephenson/bats). You should be able to 40 install it from your favorite package manager, on OS X with homebrew 41 this would look something like this: 42 43 ``` 44 $ brew install bats 45 ==> Downloading 46 https://github.com/sstephenson/bats/archive/v0.4.0.tar.gz 47 ==> Downloading from 48 https://codeload.github.com/sstephenson/bats/tar.gz/v0.4.0 49 ######################################################################## 50 100.0% 51 ==> ./install.sh /opt/boxen/homebrew/Cellar/bats/0.4.0 52 🍺 /opt/boxen/homebrew/Cellar/bats/0.4.0: 10 files, 60K, built in 2 53 seconds 54 ``` 55 56 57 58 Run the tests with: 59 60 ```bash 61 bats hello_world_test.sh 62 ``` 63 64 After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. 65 66 ## Source 67 68 This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) 69 70 71 ## External utilities 72 `Bash` is a language to write scripts that works closely with various system utilities, 73 like [`sed`](https://www.gnu.org/software/sed/), [`awk`](https://www.gnu.org/software/gawk/), [`date`](https://www.gnu.org/software/coreutils/manual/html_node/date-invocation.html) and even other programming languages, like [`Python`](https://www.python.org/). 74 This track does not restrict the usage of these utilities, and as long as your solution is portable 75 between systems and does not require installing third party applications, feel free to use them to solve the exercise. 76 77 For an extra challenge, if you would like to have a better understanding of the language, 78 try to re-implement the solution in pure `Bash`, without using any external tools. 79 80 ## Submitting Incomplete Solutions 81 It's possible to submit an incomplete solution so you can see how others have completed the exercise.