diff --git a/sphinx_beginner/exercises_beginner.rst b/sphinx_beginner/exercises_beginner.rst index 4de18ffca39cc5dd834c4e0106ac575cb59f3453..6c90c7a73be198d1dc1a9c72c12aa3109dfddfd8 100644 --- a/sphinx_beginner/exercises_beginner.rst +++ b/sphinx_beginner/exercises_beginner.rst @@ -135,6 +135,21 @@ IO and Redirections B. Next, use the :ref:`pipe <pipe>` symbol (`|`) and `sort` to sort this output *numerically* +Putting it all together +----------------------- + +#. Create a new directory named ``myscripts`` in your homedirectory + +#. Create an empty file named ``mydate`` in the newly created directory + +#. Add the directory ``~/myscripts`` to your ``PATH`` environment variable + +#. Use ``echo`` in combination with Redirection/Append to write ''date'' into the file ``~/myscripts/mydate`` + +#. Change the permissions of the file ``mydate`` to be executable by you (and you only) + +#. Run the file ``mydate`` (it should print the current date & time). Make sure you can run it from any directory (change to your homedirectory and just type ``mydate``). + Bioinformatics -------------- diff --git a/sphinx_beginner/solutions_beginner.rst b/sphinx_beginner/solutions_beginner.rst index 04010ba5767c26892739533e431f4d21ca5aa75b..60a520b9de8f724cf0df1c6ecc1db688e44a67ca 100644 --- a/sphinx_beginner/solutions_beginner.rst +++ b/sphinx_beginner/solutions_beginner.rst @@ -273,6 +273,37 @@ IO and Redirections $ cut -f3 -d':' /etc/passwd | sort -n +Putting it all together +----------------------- + +#. Create a new directory named ``myscripts`` in your homedirectory:: + + $ mkdir ~/myscripts + +#. Create an empty file named ``mydate`` in the newly created directory:: + + $ touch ~/myscripts/mydate + +#. Add the directory ``~/myscripts`` to your ``PATH`` environment variable:: + + $ export PATH=$PATH:~/myscripts + +#. Use ``echo`` in combination with Redirection/Append to write ''date'' into the file ``~/myscripts/mydate``:: + + $ echo "date" >> ~/myscripts/mydate + +#. Change the permissions of the file ``mydate`` to be executable by you (and you only):: + + $ chmod u+x ~/myscripts/mydate + $ chmod go-x ~/myscripts/mydate + +#. Run the file ``mydate`` (it should print the current date & time). Make sure you can run it from any directory (change to your homedirectory and just type ``mydate``).:: + + $ mydate + + Congratulation, you've just created and run your first shell script! + + Bioinformatics --------------