Журнал лабораторных работ

Содержание

Журнал

Среда (10/22/14)

/dev/pts/0
14:53:21
#ls
student  user
14:53:22
#tail -20 user
From root@based-debian.net.nt Wed Oct 22 15:52:06 2014
Return-path: <root@based-debian.net.nt>
Envelope-to: user@based-debian.net.nt
Delivery-date: Wed, 22 Oct 2014 15:52:06 +0300
Received: from root by debian1.net.nt with local (Exim 4.80)
        (envelope-from <root@based-debian.net.nt>)
        id 1XgvOY-0003UM-59
        for user@based-debian.net.nt; Wed, 22 Oct 2014 15:52:06 +0300
Date: Wed, 22 Oct 2014 15:52:06 +0300
To: user@based-debian.net.nt
Subject: Privet user
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <E1XgvOY-0003UM-59@debian1.net.nt>
From: root <root@based-debian.net.nt>
privet
14:53:30
#cd

14:53:46
#cat hello.sh
#!/bin/bash
for c_user in $*
   do
        echo privet | mail -s "Privet $c_user" $c_user
   done
14:53:52
#test -d 1

прошло 30 минут
15:24:46
#test -d d1

15:24:55
#echo $?
1
15:25:12
#ls
hello.sh  install  ip  i_p  passwd  source  Tux.jpg  wget.txt  words  xargs.txt
15:25:41
#ls -a
.   .aptitude      .bash_profile  hello.sh  ip   .l3rc     .lilalo  passwd    source   .vim      .vimrc    words
..  .bash_history  .bashrc        install   i_p  .lesshst  .links2  .profile  Tux.jpg  .viminfo  wget.txt  xargs.txt
15:25:47
#test i_p

15:28:42
#echo $?
0
15:28:45
#test -d i_p

15:28:51
#echo $?
1
15:28:53
#[ -d i_p ]

15:29:08
#echo $?
1
15:29:10
#[ i_p ]

15:29:14
#echo $?
0
15:29:16
#cp no_file /tmp
cp: не удалось выполнить stat для «no_file»: Нет такого файла или каталога
прошло 20 минут
15:50:06
#echo $?
1
15:50:27
#touch no_file

15:50:40
#cp no_file /tmp/

15:50:48
#echo$?
l3script: echo0: команда не найдена
15:50:54
#echo $?
127
15:50:57
#cp no_file /tmp/test 5 -gt 1
cp: неверный ключ -- g
Попробуйте «cp --help» для получения более подробного описания.
15:51:32
#test 5 -gt 1

15:51:48
#test 5 -lt 1

15:51:56
#echo $?
1
15:51:57
#test -z "$STRING"

15:52:20
#echo $?
0
15:52:21
#test "$P" !=print
l3script: test: : ожидается использование унарного оператора
15:53:21
#test -e /etc/motd

15:53:52
#echo $?
0
15:53:54
#test -d /usr/local/bin/

15:54:11
#test -r /etc/shadow

15:54:28
#echo $?
0
15:54:29
#test -k /tmp/

15:54:39
#help test
test: test [expr]
    Evaluate conditional expression.
    Exits with a status of 0 (true) or 1 (false) depending on
    the evaluation of EXPR.  Expressions may be unary or binary.  Unary
    expressions are often used to examine the status of a file.  There
    are string operators and numeric comparison operators as well.
    The behavior of test depends on the number of arguments.  Read the
    bash manual page for the complete specification.
    File operators:
      -a FILE        True if file exists.
...
      arg1 OP arg2   Arithmetic tests.  OP is one of -eq, -ne,
                     -lt, -le, -gt, or -ge.
    Arithmetic binary operators return true if ARG1 is equal, not-equal,
    less-than, less-than-or-equal, greater-than, or greater-than-or-equal
    than ARG2.
    See the bash manual page bash(1) for the handling of parameters (i.e.
    missing parameters).
    Exit Status:
    Returns success if EXPR evaluates to true; fails if EXPR evaluates to
    false or an invalid argument is given.
15:54:44
#test -k /tmp/

15:55:35
#echo $?
0
15:55:38
#test -w /etc/passwd

16:00:47
#echo $?
0
16:00:48
#x=5

16:01:25
#y=10

16:01:56
#test x -gt y
l3script: test: x: integer expression expected
16:02:09
#test $x -gt $y

16:02:22
#echo $?
1
16:02:25
#test $x -le $y

16:02:34
#echo $?
0
16:02:36
#echo "Your Lovely colour?" ; read FAV_COL ; \
> red
Your Lovely colour?
red
l3script: red: команда не найдена
16:04:45
#unset x,y
l3script: unset: `x,y': неправильный идентификатор
16:05:34
#unset x y

16:05:37
#x
l3script: x: команда не найдена
16:05:39
#set
BASH=/usr/local/bin/l3script
BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="2" [2]="37" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
BASH_VERSION='4.2.37(1)-release'
...
MACHTYPE=x86_64-pc-linux-gnu
MAIL=/var/mail/root
MAILCHECK=60
OLDPWD=/var/mail
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PIPESTATUS=([0]="127")
PPID=9240
16:05:43
#set x

16:05:46
#a=0

16:07:13
#while [$a -lt 10]
> do
> a=$((a+1))
> echo $a
> done
l3script: [0: команда не найдена
16:07:53
#while [ $a -lt 10 ]; do a=$((a+1)); echo $a; done
1
2
3
4
5
6
7
8
9
10
16:08:08
#set a

16:08:15
#echo $a
10
16:08:21
#for file in /etc/*
> do
> [ -r $file ] || echo $file
> done
16:09:13
#echo $?
0
16:09:19
#ls -l /etc/
итого 692
drwxr-xr-x 3 root root    4096 Окт 13 17:49 acpi
-rw-r--r-- 1 root root    2981 Июн 27 10:59 adduser.conf
-rw-r--r-- 1 root root      44 Окт 15 16:25 adjtime
-rw-r--r-- 1 root root     196 Июн 27 11:18 aliases
drwxr-xr-x 2 root root    4096 Окт 22 14:32 alternatives
drwxr-xr-x 6 root root    4096 Окт 13 17:45 apt
-rw-r--r-- 1 root root    1910 Окт 21 14:32 bash.bashrc
-rw-r--r-- 1 root root      45 Июн 17  2012 bash_completion
drwxr-xr-x 2 root root    4096 Июн 27 11:18 bash_completion.d
...
-rw-r--r-- 1 root root      12 Июн 27 11:57 timezone
-rw-r--r-- 1 root root    1552 Окт 19  2012 trafshow
-rw-r--r-- 1 root root    1260 Май 30  2008 ucf.conf
drwxr-xr-x 4 root root    4096 Июн 27 10:59 udev
drwxr-xr-x 3 root root    4096 Июн 27 11:52 ufw
drwxr-xr-x 2 root root    4096 Июн 27 10:59 vim
drwxr-xr-x 2 root root    4096 Июн 27 12:01 w3m
-rw-r--r-- 1 root root    4496 Фев  1  2014 wgetrc
drwxr-xr-x 3 root root    4096 Июн 27 11:00 X11
drwxr-xr-x 2 root root    4096 Июн 27 12:00 xml
16:10:23