#! /usr/bin/env python | |
import os,subprocess | |
from stat import * | |
export x=2asdfasdbxcb | |
os.environ['x'] = "2asdfasdbxcb" | |
export y=3asdfasdzsdgzs | |
os.environ['y'] = "3asdfasdzsdgzs" | |
# Calculate the average of a series of numbers. | |
SCORE="0" | |
# Calculate the average of a series of numbers. | |
SCORE="0" | |
AVERAGE="0" | |
AVERAGE="0" | |
SUM="0" # comment at end of line | |
SUM="0" | |
# comment at beginning of line | |
NUM="0" | |
# comment at end of line | |
# comment at beginning of line | |
NUM="0" | |
foo=`cat /tmp/baz` | |
foo=os.popen("cat /tmp/baz").read() | |
while true; do echo -n "Enter your score [0-100%] ('q' for quit): "; read SCORE; if (("$SCORE" < "0")) || (("$SCORE" > "100")); then echo "Be serious. Common, try again: " elif [ "$SCORE" == "q" ]; then echo "Average rating: $AVERAGE%." break else SUM=$[$SUM + $SCORE] NUM=$[$NUM + 1] AVERAGE=$[$SUM / $NUM] fi done | |
while (True): print("Enter your score [0-100%] ('q' for quit): ") SCORE = raw_input() if ("$SCORE" < "0" or "$SCORE" > "100" ): print("Be serious. Common, try again: ") elif ("SCORE" == ""q"" ): print("Average rating: " + str(AVERAGE) + "%.") break else: SUM=[SUM +" SCORE] NUM=[NUM +" 1] AVERAGE=[SUM /" NUM] | |
echo "Exiting." | |
print("Exiting.") | |
# Cleanup | |
# Run as root, of course. | |
cd /var/log | |
# Cleanup | |
# Run as root, of course. | |
os.chdir("/var/log") | |
cat /dev/null > messages | |
_rc = subprocess.call("cat /dev/null",shell=True,stdout=file('messages','wb')) | |
cat /dev/null > wtmp | |
_rc = subprocess.call("cat /dev/null",shell=True,stdout=file('wtmp','wb')) | |
echo "Log files cleaned up." | |
print("Log files cleaned up.") | |
Msg=`printf "%s %s \n" $Message1 $Message2` | |
Msg=os.popen("printf \"%s %s n\" "+str(Message1)+" "+str(Message2)).read() | |
echo $Msg; echo $Msg | |
print(Msg) print(Msg) | |
ÿ |