Summary (and not only) - Prof. dr. Razvan Daniel ZOTA ...
Seminar #3Summary (and not only)Decision making commands in bash: if and case During the seminar #3 I’ve presented to you some examples involving decision making (the commands if…fi and case…esac).if..fi commandIn the figure above you have a script example where we input two numbers stored in variables a and b and we compare (numerically) these two numbers using the if command, the condition being [ $a –gt $b ] (-gt stands for “greater or equal”). For more about different types of operators, see Chapter 15 in the unix_tutorial pdf.case..esac commandIn the previous figure we have a simple case example: we enter the name of a colour, and depending of what we are entering, we get the corresponding message. If no “pattern” is recognized, we will get the last message: “I know nothing about it!!!!” (Remember that the * meta-character acts for any string of chars).NOTE. Redirecting standard outputAs we saw in previous examples at the course and seminar, we may redirect a command using the redirect output symbol (>). The format of the command line that redirects output is:command [arguments] > filenamewhere command is any executable program, arguments are optional arguments and filename is the name of the ordinary file the shell redirects the output to.We must be careful when redirecting output, because this operation may destroy a file! When we want to be prevented of overwriting files, we may use the noclobber function of the shell that prevents overwriting a file using redirection.Here is an example of how it’s working:So, using bash you may enable this feature by setting noclobber using the command set –o noclobber. We may reverse it using set +o noclobber. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- linux tutorial managing group access on linux and unix
- the openap project winlab
- supplemental file 1 researchgate
- introduction edu
- command substitution in an echo mobile itnt solutions
- summary and not only prof dr razvan daniel zota
- homework 3 csc 134 summer 2002 prof
- introduction to sedimentary rock texture and composition
- securitydocs comment on netcat tutorial