Skriptimine 2017: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Mrajur (talk | contribs)
No edit summary
Mrajur (talk | contribs)
No edit summary
Line 113: Line 113:
  '''fi'''
  '''fi'''
  http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
  http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
==Exit koodid==
Viimase käivitatud käsu exit koodi leiate muutujast $?
Juhul kui käsk õnnestus on exitkood 0
Juhul kui käsu käivitamisel tekkis tõrke on exit kood 0'ist erinev

Revision as of 09:14, 6 February 2017

Hindamiskriteeriumid

Arvestuse saamiseks peab tudeng esitama järgmised tööd:

2 kodutööd
3+3 hinnangut teiste kodutöödele
Kaitstud praktikumide tööd
2 kontrolltööd

Labori keskkond

https://elab.itcollege.ee/users/sign_in

Labs -> Skriptimine 2017
Kasutaja: student
Parool: student

Linuxi käsud

Käsk Funktsioon Man link Näidis
cd Change Directory http://www.skrenta.com/rt/man/cd.1.html cd /var/log
ls list directory contents http://www.skrenta.com/rt/man/ls.1.html ls -lah /var/log
ps report process status http://www.skrenta.com/rt/man/ps.1.html ps -ef
grep print lines matching a pattern http://www.skrenta.com/rt/man/grep.1.html grep -R 'error' /var/log/*
tail output the last parts of file http://www.skrenta.com/rt/man/tail.1.html tail -f /var/log/syslog
cat concatenate files and print on the standard output http://www.skrenta.com/rt/man/cat.1.html cat /var/log/syslog
man format and display the on-line manual pages http://www.skrenta.com/rt/man/man.1.html man man
su run a shell with substitute user and group IDs http://www.skrenta.com/rt/man/su.1.html su - root
cp copy files and directories http://www.skrenta.com/rt/man/cp.1.html cp /var/log/syslog /tmp/tmp_syslog
mv move (rename) files/directories http://www.skrenta.com/rt/man/mv.1.html mv /var/log/syslog.5 /arhiiv
rm remove files or directories http://www.skrenta.com/rt/man/rm.1.html rm /tmp/tmp_syslog
sed Stream editor http://www.skrenta.com/rt/man/sed.1.html sed -ie 's/mida/millega/g' /tmp/tmp_syslog
mkdir make directories http://www.skrenta.com/rt/man/mkdir.1.html mkdir /tmp/skript
chmod change file access premissions http://www.skrenta.com/rt/man/chmod.1.html chmod 700 /tmp/skript/myscript.sh
chown change file owner or group http://www.skrenta.com/rt/man/chown.1.html chown student:student /tmp/skript/myscript.sh
chgrp Change group ownership http://www.skrenta.com/rt/man/chgrp.1.html chgrp root /tmp/skript/myscript.sh

Bash-i info

If lause moodustamine

if [ Funktsioon ] then
tee midagi
fi
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

Exit koodid

Viimase käivitatud käsu exit koodi leiate muutujast $?
Juhul kui käsk õnnestus on exitkood 0
Juhul kui käsu käivitamisel tekkis tõrke on exit kood 0'ist erinev