summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/copy_rename_20_files_tail_env
diff options
context:
space:
mode:
authormp1846@student.uni-lj.si <mp1846@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-01-25 14:18:27 +0000
committermp1846@student.uni-lj.si <mp1846@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-01-25 14:18:27 +0000
commit6980c19d938b2a83edd6a82ae5223dc2644c59cd (patch)
tree5fa47fd209a01440b4d76f61d652b40c504ad6d5 /kpov_judge/tasks/copy_rename_20_files_tail_env
parent82364980e896687a8b4dbca4421ece99b12f5938 (diff)
*Dokoncal sem task funkcijo oz. dodal se 4 sub-taske, katere sem si sam izmislil.
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@229 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks/copy_rename_20_files_tail_env')
-rw-r--r--kpov_judge/tasks/copy_rename_20_files_tail_env/task.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
index dc2e0da..e7c0ad7 100644
--- a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
+++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
@@ -7,14 +7,14 @@ instructions = {
'si':u"""
Prijavi se na sistem.
V domači mapi najdeš imenik Mapa z 20 datotekami.
- - preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji
+ - Preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji
- Napiši čim krajši ukaz, ki vse datoteke iz /home/user/mapa/mojimenik premakne v /home/user/novi
- Napiši ukaz, ki s pomočjo ukaza grep v datoteko "mama.txt" izpiše vse navade (ne skrite) datoteke v trenutnem imeniku, ki vsebujejo niz "mama", v datoteko "napake.txt" pa izpiše vse morebitne napake (npr. to, da so nekateri objekti v trenutnem imeniku dejansko imeniki ali napačne simbolične povezave)
- Napiši ukaz, ki bo 5s sledil vsebini /var/log/syslog. V primeru, da se v syslogu pojavi niz "zmeda", naj program izpiše "imam ga". Poleg tega naj program med sledenjem syslog-u odšteva od 5 do 1 (vsako sekundo naj se izpiše naslednja številka.
- Nastavi okoljsko spremenljivko TEST, da bo imela isto vrednost kot okoljska spremenljivka USER + število okoljskih spremenljivk, ki v imenu ali vrednosti ne vsebujejo besede TEST. Primer: polz37
- S pomočjo programa cURL shrani vsebino spletne strani www.google.com v datoteko z imenom website.txt
- - Napiši ukaz, ki bo število pojavitev značke <div> v datoteki website.txt dodal na konec te iste datoteke brez, da bi se ukaz zapisal v zgodovino ukazov "bash history"
- - Napiši ukaz brez uporabe programa cron, kateri 5 minut po izvedbi izpiše vsebino imenika v katerem se trenutno nahajaš
+ - V imeniku "Mapa" najdeš datoteko count.txt. Preštej število vrstic v njej in rezultat zapiši v novo datoteko lines.txt
+ - Namesti paket "cowsay" in ga preizkusi :)
- Napiši najkrajši ukaz, ki s pomočjo Pythona zažene preprost (integriran) HTTP strežnik kateri streže datoteke iz imenika iz katerega je bil pognan na vratih 8000
""",
@@ -34,8 +34,8 @@ second(5 to 1) to show the status of the tracker.
variable USER + the number of variables that do not include the name
TEST, for example polz37.
- With the help of cURL fetch the website content of www.google.com and save it into file named website.txt
-- Write a command which will count the number of <div> tags in the filename website.txt and will then append the result to this same file. Command should not be logged in "bash history"!
-- Write a command (don't use cron!) which will list all the files in the current directory 5 minutes after execution
+- In directory "Mapa" exists file count.txt
+- Install packet "cowsay" and test it :)
- Write shortest command possible which will with the help of Python start a simple (integrated) HTTP server and will serve the files from the current directory on port 8000."""
}
@@ -83,22 +83,35 @@ def task():
# imena datotek pa so: 1,1-,2,2-,3,3-,4,5,6,7,8,9,.mama1,mama2,mama3,mama4,mama5,mojimenik,novi,oce1
# v mojimenik se nahaja mojimenikfile
# mama2 vsebuje "mama"
+ #Stirje subt-aski dodani.By Mihec.
import subprocess
results = dict()
- p=subprocess.check_output(["ls","-a", "/home/student/Desktop/Mapa"])
+ p = subprocess.check_output(["ls","-a", "/home/student/Desktop/Mapa"])
results['preimenuj'] = p
- # ta more met mojimenikfile
+ # ta more met mojimenikfile
results['novi'] = subprocess.check_output(["ls", "/home/student/Desktop/Mapa/novi"])
+
# ta more bit prazen
- results['mojimenik']=subprocess.check_output(["ls", "/home/student/Desktop/Mapa/mojimenik"])
+ results['mojimenik'] = subprocess.check_output(["ls", "/home/student/Desktop/Mapa/mojimenik"])
# ta more met mama2
- results['mamatxt']=subprocess.check_output(["cat", "/home/student/Desktop/mama.txt"])
+ results['mamatxt'] = subprocess.check_output(["cat", "/home/student/Desktop/mama.txt"])
+
# ta pa grep: mojimenik: Is a directory, grep: novi: Is a directory
- results['napaketxt']=subprocess.check_output(["cat", "/home/student/Desktop/napake.txt"])
-
+ results['napaketxt'] = subprocess.check_output(["cat", "/home/student/Desktop/napake.txt"])
+
+ results['curl'] = subprocess.check_output(["cat","/home/student/Desktop/website.txt"])
+
+ results['count'] = subprocess.check_output(["wc","/home/student/Desktop/count.txt"])
+
+ results['cowsay'] = subprocess.check_output(["dpkg --get-selections | grep","cowsay"])
+
+ results['phttp'] = subprocess.check_output(["ps aux | grep ","SimpleHTTPServer"])
+
+
+
return results