Specijalni znakovi komandne linije
Razni znakovi komandne linije :
” “ double quotes – double quotes allow variable expansion
‘ ‘ single quotes – anything within single quotes is interpreted literally, single quotes completely protect a string from the shell (script)
` ` backticks – Text within backticks is treated as a separate command whose results are substituted on the command line.
& ampersand – tells the shell to go on to the next line without waiting for the first to finish.
\ escape – If you want to match one of the special characters, such as a dot, you must escape it—that is, precede it with a backslash (\)
$? – holds the exit status of the last executed command
~ – refers to user`s home directory
> Creates a new file containing standard output. If the specified file exists, it’s overwritten.
>> Appends standard output to the existing file. If the specified file doesn’t exist, it’s created.
2> Creates a new file containing standard error. If the specified file exists, it’s overwritten.
2>> Appends standard error to the existing file. If the specified file doesn’t exist, it’s created.
&> Creates a new file containing both standard output and standard error. If the specified file exists, it’s overwritten.
< Sends the contents of the specified file to be used as standard input.
<< Accepts text on the following lines as standard input.
<> Causes the specified file to be used for both standard input and standard output.
xargs builds a command from its standard input
| – pipe – the standard output from one program is redirected as the standard input to a second program
Conditional expressions (in scripts) :
&& – logical AND
|| – logical OR
if+then+else+fi – IF
case+esac – za nabrajanje više komandi
while+do+done – petlja koja se izvršava sve dok je uslov petlje true
until+do+done – petlja koja se izvršava sve dok je uslov petlje false
for+do+done – petlja
Variables that are passed to the script are frequently called parameters or arguments. They’re represented in the script by a dollar sign ($) followed by a number from 0 up—$0 stands for the name of the script, $1 is the first parameter to the script, $2 is the second parameter, and so on.