Bash scripts

← Term 2

Last updated: 11-04-2017.

Information about PS1 variable

PS1 default value is ' \u@\h:\w\$ '. You see this variable every time you log in. By default, in Ubuntu systems, this should take the form of: username@hostname: current_directory$ if you are normal user and username@hostname: current_directory# if you are the root user. When it became clear that it is possible change the appearance of PS1 form, I decided to change two things: firstly I added space after "$" symbol and then I changed colors of 'username@hostname:', 'current_directory' and '$' to purple, blue and red respectively. Also, I made whole variable form bold. At first glance this may seem like something awkward and meaningless, but I believe that it will help me to distinguish information on the command line faster and easier especially after a long working sessions. Now PS1 has value ' \[\e[1;35m\]\u@\h:\[\e[34m\]\w\[\e[1;31m\]$ \[\e[0m\] '.

Notes for the third task

In the process of creating the script, it was found that emboss spams shell with 'Alter the name or description of a sequence.' line. So, it was desided to redirect stderr to /dev/null (2> /dev/null).

Notes for the fourth task

During the execution of the task in addition to the standard requirements, simple 'foolproof' was created: letters in lower case will be interpreted as in upper case. If entered value won't belong to A-Z letters at least or it's length will be more that one character, script will write "ERROR, CHECK INPUT".

© Simon Galkin, 2016