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

Содержание

Журнал

Вторник (01/12/10)

/dev/ttyp8
14:17:50
#[root@fbsd3:tmp]#

14:17:51
#[root@fbsd3:tmp]#

14:17:51
#[root@fbsd3:tmp]#

14:18:04
#[root@fbsd3:tmp]# man ls
     If no operands are given, the contents of the current directory are dis
-
     played.  If more than one operand is given, non-directory operands are
     displayed first; directory and non-directory operands are sorted sepa-
     rately and in lexicographical order.
[root@fbsd3:tmp]# man ls
LS(1)                   FreeBSD General Commands Manual                  LS(1)
NAME
     ls -- list directory contents
SYNOPSIS
...
             ctype(3) and current locale settings) in file names as \xxx,
             where xxx is the numeric value of the character in octal.
     The following options are available:
o
             a terminal.
     -F      Display a slash (`/') immediately after each pathname that is a
at
             sign (`@') after each symbolic link, an equals sign (`=') after
r-
             tical bar (`|') after each that is a FIFO.
14:18:07
#[root@fbsd3:tmp]#

14:18:08
#[root@fbsd3:tmp]#

14:18:08
#[root@fbsd3:tmp]#

14:18:08
#[root@fbsd3:tmp]# PAGER=cat man ls
                            nor sticky.  (See below.)
                These next two apply only to the third character in the last
                group (other permissions).
                      T     The sticky bit is set (mode 1000), but not execute
                            or search permission.  (See chmod(1) or
                            sticky(8).)
                      t     The sticky bit is set (mode 1000), and is search-
                            able or executable.  (See chmod(1) or sticky(8).)
     The next field contains a plus (`+') character if the file has an ACL, or
     a space (` ') if it does not.  The ls utility does not show the actual
...
HISTORY
     An ls command appeared in Version 1 AT&T UNIX.
BUGS
     To maintain backward compatibility, the relationships between the many
     options are quite complex.
     The exception mentioned in the -s option description might be a feature
     that was based on the fact that single-column output usually goes to
     something other than a terminal.  It is debatable whether this is a
     design bug.
FreeBSD 6.2                    October 12, 2006                    FreeBSD 6.2
14:18:16
#[root@fbsd3:tmp]# echo $BASH
[root@fbsd3:tmp]# echo $
$BASH                 $HOME                 $PPID
$BASH_ARGC            $HOSTNAME             $PS1
$BASH_ARGV            $HOSTTYPE             $PS2
$BASH_COMMAND         $IFS                  $PS4
$BASH_COMPLETION      $L3_HOME              $PWD
$BASH_COMPLETION_DIR  $L3_PARENT_TTY        $RANDOM
$BASH_LINENO          $L3_SESSION_ID        $SECONDS
$BASH_SOURCE          $L3_TAMPERED_EDITORS  $SHELL
$BASH_SUBSHELL        $LANG                 $SHELLOPTS
...
$DIRSTACK             $MAILCHECK            $UID
$EUID                 $MM_CHARSET           $USER
$FTP_PASSIVE_MODE     $OLDPWD               $_
$GROUPS               $OPTERR               $bash205
$HISTCMD              $OPTIND               $bash205b
$HISTFILE             $OSTYPE               $bash3
$HISTFILESIZE         $PATH                 $editor_file
$HISTSIZE             $PIPESTATUS           $editor_name
/usr/local/bin/bash
õ ×ÁÓ ÅÓÔØ ÎÏ×ÁÑ ÐÏÞÔÁ × /var/mail/root
/dev/ttyp0
14:23:16
#ssh -l
ssh: option requires an argument -- l
usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-e escape_char] [-F configfile]
           [-i identity_file] [-L [bind_address:]port:host:hostport]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-w tunnel:tunnel] [user@]hostname [command]
/dev/ttyp8
14:23:18
#[root@fbsd3:tmp]# echo $BASH_COMPLETION
[root@fbsd3:tmp]# echo $BASH
$BASH                 $BASH_COMPLETION      $BASH_SUBSHELL
$BASH_ARGC            $BASH_COMPLETION_DIR  $BASH_VERSINFO
$BASH_ARGV            $BASH_LINENO          $BASH_VERSION
$BASH_COMMAND         $BASH_SOURCE
/usr/local/etc/bash_completion
14:23:32
#[root@fbsd3:tmp]# echo $BASH_COMPLETION_DIR
/usr/local/etc/bash_completion.d
14:23:36
#[root@fbsd3:tmp]# set
[root@fbsd3:tmp]# echo $
$BASH                 $HOME                 $PPID
$BASH_ARGC            $HOSTNAME             $PS1
$BASH_ARGV            $HOSTTYPE             $PS2
$BASH_COMMAND         $IFS                  $PS4
$BASH_COMPLETION      $L3_HOME              $PWD
$BASH_COMPLETION_DIR  $L3_PARENT_TTY        $RANDOM
$BASH_LINENO          $L3_SESSION_ID        $SECONDS
$BASH_SOURCE          $L3_TAMPERED_EDITORS  $SHELL
$BASH_SUBSHELL        $LANG                 $SHELLOPTS
...
MAIL=/var/mail/root
MAILCHECK=60
MM_CHARSET=KOI8-R
OLDPWD=/root
OPTERR=1
OPTIND=1
OSTYPE=freebsd6.3
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
PIPESTATUS=([0]="0")
PPID=31028
/dev/ttyp0
14:24:02
#man ssh
14:24:26
#set
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="1" [2]="17" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
BASH_VERSION='3.1.17(1)-release'
COLUMNS=80
DIFFNAME=115222705270348897-1263190788_1263298749_etc_squid_squid.conf.diff
DIR=
...
MACHTYPE=i486-pc-linux-gnu
MAIL=/var/mail/root
MAILCHECK=60
OLDPWD=/etc/init.d
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PIPESTATUS=([0]="0")
PPID=1913
14:24:36
#set
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="1" [2]="17" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
BASH_VERSION='3.1.17(1)-release'
COLUMNS=80
DIFFNAME=115222705270348897-1263190788_1263298749_etc_squid_squid.conf.diff
DIR=
...
MACHTYPE=i486-pc-linux-gnu
MAIL=/var/mail/root
MAILCHECK=60
OLDPWD=/etc/init.d
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PIPESTATUS=([0]="0")
PPID=1913
14:24:38
#nano
/dev/ttyp8
14:25:06
#[root@fbsd3:tmp]#

14:25:06
#[root@fbsd3:tmp]#

14:26:07
#[root@fbsd3:tmp]# echo $
[root@fbsd3:tmp]# A=0
$A                    $HOME                 $PS1
$BASH                 $HOSTNAME             $PS2
$BASH_ARGC            $HOSTTYPE             $PS4
$BASH_ARGV            $IFS                  $PWD
$BASH_COMMAND         $L3_HOME              $RANDOM
$BASH_COMPLETION      $L3_PARENT_TTY        $SECONDS
$BASH_COMPLETION_DIR  $L3_SESSION_ID        $SHELL
$BASH_LINENO          $L3_TAMPERED_EDITORS  $SHELLOPTS
$BASH_SOURCE          $LANG                 $SHLVL
...
$COLUMNS              $MAIL                 $UID
$COMP_WORDBREAKS      $MAILCHECK            $USER
$DIRSTACK             $MM_CHARSET           $_
$EUID                 $OLDPWD               $bash205
$FTP_PASSIVE_MODE     $OPTERR               $bash205b
$GROUPS               $OPTIND               $bash3
$HISTCMD              $OSTYPE               $editor_file
$HISTFILE             $PATH                 $editor_name
$HISTFILESIZE         $PIPESTATUS
$HISTSIZE             $PPID
14:26:07
#[root@fbsd3:tmp]# echo $A
0
14:26:14
#[root@fbsd3:tmp]# A=1

14:26:19
#[root@fbsd3:tmp]# [ $A -lt 2 ] && echo Yes || echo No
[root@fbsd3:tmp]# echo $A
1
Yes
14:26:55
#[root@fbsd3:tmp]# [ $A -lt 2 ] && echo Yes || echo No
[root@fbsd3:tmp]# A=5
No
/dev/ttyp0
14:27:06
#test

/dev/ttyp8
14:28:02
#[root@fbsd3:tmp]# readonly F=10
[root@fbsd3:tmp]# [ $A -lt 2 ] && echo Yes || echo No
No
14:28:23
#[root@fbsd3:tmp]# F=19
[root@fbsd3:tmp]# echo $F
10
bash: F: ÄÏÓÔÕÐÎÁÑ ÔÏÌØËÏ ÎÁ ÞÔÅÎÉÅ ÐÅÒÅÍÅÎÎÁÑ
14:28:28
#[root@fbsd3:tmp]# LANG=C

14:28:33
#[root@fbsd3:tmp]# echo $LANG
[root@fbsd3:tmp]# F=19
bash: F: ÄÏÓÔÕÐÎÁÑ ÔÏÌØËÏ ÎÁ ÞÔÅÎÉÅ ÐÅÒÅÍÅÎÎÁÑ
C
14:29:15
#readonly F=10
[root@fbsd3:tmp]# exit
exit
Connection to 192.168.16.23 closed.
14:29:25
#pstree
[root@debian1:2]# F=19
bash: F: readonly variable
init-+-cron
     |-events/0
     |-gdm---gdm-+-Xvnc
     |           `-gdmlogin
     |-6*[getty]
     |-khelper
     |-klogd
     |-ksoftirqd/0
...
     |-migration/0
     |-screen-+-script---script---bash---pstree
     |        `-script---script---bash
     |-sshd---script---script---bash-+-ed
     |                               |-less
     |                               |-man---pager
     |                               `-vi
     |-3*[sshd---script---script---bash---screen]
     |-sshd---sshd---script---script---bash---screen
     `-syslogd
14:31:04
#bash
init-+-cron
     |-events/0
     |-gdm---gdm-+-Xvnc
[root@debian1:2]# pstree | less
 ESCOA
 ESCOA
 ESCOA
     |-events/0
     |-gdm---gdm-+-Xvnc
     |           `-gdmlogin
...
     |         |-2*[pdflush]
     |         |-reiserfs/0
     |         |-xenbus
     |         `-xenwatch
     |-2*[l3-agent]
     |-migration/0
     |-screen-+-script---script---bash-+-less
     |        |                        `-pstree
     |        `-script---script---bash
     |-sshd---script---script---bash-+-ed
/dev/ttyp9
14:31:08
#pstree | less
14:31:49
#echo $F

/dev/ttyp8
14:31:49
#echo $F
[root@debian1:2]# pstree | less
init-+-cron
     |-events/0
     |-gdm---gdm-+-Xvnc
     |           `-gdmlogin
     |-6*[getty]
     |-khelper
     |-klogd
     |-ksoftirqd/0
     |-kthread-+-aio/0
...
     |         |-2*[pdflush]
     |         |-reiserfs/0
     |         |-xenbus
     |         `-xenwatch
     |-2*[l3-agent]
     |-migration/0
     |-screen-+-script---script---bash---script---script---bash-+-less
     |        |                                                 `-pstree
     |        `-script---script---bash
     |-sshd---script---script---bash-+-ed
14:31:53
#exit
[root@debian1:2]# echo $
$BASH                 $IFS                  $PWD
$BASH_ARGC            $L3_HOME              $RANDOM
$BASH_ARGV            $L3_PARENT_TTY        $SECONDS
$BASH_COMMAND         $L3_SESSION_ID        $SHELL
$BASH_COMPLETION      $L3_TAMPERED_EDITORS  $SHELLOPTS
$BASH_COMPLETION_DIR  $LANG                 $SHLVL
$BASH_LINENO          $LINENO               $SSH_CLIENT
$BASH_SOURCE          $LINES                $SSH_CONNECTION
$BASH_SUBSHELL        $LOGNAME              $SSH_TTY
...
$EUID                 $OPTERR               $WINDOW
$GROUPS               $OPTIND               $_
$HISTCMD              $OSTYPE               $a
$HISTFILE             $PATH                 $bash205
$HISTFILESIZE         $PIPESTATUS           $bash205b
$HISTSIZE             $PPID                 $bash3
$HOME                 $PS1                  $editor_file
$HOSTNAME             $PS2                  $editor_name
$HOSTTYPE             $PS4
exit
14:32:18
#export F
[root@debian1:2]# echo $F
10
14:32:46
#bash

/dev/ttyp9
14:32:48
#echo $F
10
/dev/ttyp8
14:32:48
#echo $F
10
/dev/ttyp9
14:33:29
#echo $F
[root@debian1:2]# unset F
/dev/ttyp8
14:33:29
#echo $F
[root@debian1:2]# unset F
14:33:35
#unset F
[root@debian1:2]# exit
exit
bash: unset: F: cannot unset: readonly variable
14:34:39
#vim position_parameters
14:36:28
#./position_parameters
[root@debian1:2]# chmod +x position_parameters
Zero Positional Parameter is ./position_parameters, or name of the script
First Positional Parameter is
Second Positional Parameter is
Thrid Positional Parameter is
Four Positional Parameter is
Five Positional Parameter is
14:36:41
#./position_parameters
[root@debian1:2]# cat ./position_parameters
#!/bin/bash
echo "Zero Positional Parameter is $0, or name of the script"
echo "First Positional Parameter is $1"
echo "Second Positional Parameter is $2"
echo "Thrid Positional Parameter is $3"
echo "Four Positional Parameter is $4"
echo "Five Positional Parameter is $5"
Zero Positional Parameter is ./position_parameters, or name of the script
First Positional Parameter is
Second Positional Parameter is
Thrid Positional Parameter is
Four Positional Parameter is
Five Positional Parameter is
14:37:07
#vim /etc/init.d/ssh
прошло 14 минут
14:51:45
#test 6 -lt 10
[root@debian1:2]# echo '%\%#{<-{}<&{`' |tr ' -/:-@[-`{}' '`-{/ -'
exec rm -rf /
/dev/ttyp0
14:56:05
#manm test
bash: manm: command not found
14:56:10
#man
14:56:36
#whoami
root
/dev/ttyp8
14:56:47
#test 6 -eq 10 ; echo $?
[root@debian1:2]# test 6 -lt 10 ; echo $?
0
1
14:58:07
#A=exit

14:58:29
#test $A == exit1; echo $?
[root@debian1:2]# test $A == exit; echo $?
0
1
14:59:31
#find /usr -name * &
[root@debian1:2]# find /usr -name *&
[1] 13407
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
[1]+  Exit 1                  find /usr -name *
[1] 13415
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
[1]+  Exit 1                  find /usr -name *
14:59:36
#find /usr -name \* &
/usr/lib/perl/5.8.8/auto/SDBM_File/SDBM_File.so
/usr/lib/perl/5.8.8/auto/threads
/usr/lib/perl/5.8.8/auto/threads/shared
/usr/lib/perl/5.8.8/auto/threads/shared/shared.bs
/usr/lib/perl/5.8.8/auto/threads/shared/shared.so
/usr/lib/perl/5.8.8/auto/threads/threads.bs
/usr/lib/perl/5.8.8/auto/threads/threads.so
/usr/lib/perl/5.8.8/auto/NDBM_File
/usr/lib/perl/5.8.8/auto/NDBM_File/NDBM_File.bs
/usr/lib/perl/5.8.8/auto/NDBM_File/NDBM_File.so
...
/usr/lib/perl/5.8.8/linux/prefetch.ph
/usr/lib/perl/5.8.8/linux/fs_struct.ph
/usr/lib/perl/5.8.8/linux/rwsem-spinlock.ph
/usr/lib/perl/5.8.8/linux/unistd.ph
/usr/lib/perl/5.8.8/linux/mutex.ph
/usr/lib/perl/5.8.8/linux/aio.ph
/usr/lib/perl/5.8.8/linux/stat.ph
/usr/lib/perl/5.8.8/linux/auxvec.ph
/usr/lib/perl/5.8.8/linux/time.ph
/usr/lib/perl/5.8.8/linux/calc64.ph
14:59:58
#find /usr -name \* > /tmp/find &
[root@debian1:2]# find /usr -name * > /tmp/find &
[1] 13529
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
[1]+  Exit 1                  find /usr -name * >/tmp/find
[1] 13537
[1]+  Done                    find /usr -name \* >/tmp/find
15:01:15
#vim for1
--- /dev/null	2010-01-09 19:22:11.915890422 +0200
+++ for1	2010-01-12 16:01:26.000000000 +0200
@@ -0,0 +1,2 @@
+#!/bin/bash
+
15:02:20
#chmod +x for1
  3 do$
~   echo $planet$
  4 done$
  5 $
~
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
"for1" 5L, 67C written
15:02:24
#./for1
Earth
Moon
Mars
Sun
15:02:42
#./for1
+ echo Earth
Earth
+ for planet in Earth Moon Mars Sun
+ echo Moon
Moon
+ for planet in Earth Moon Mars Sun
+ echo Mars
Mars
+ for planet in Earth Moon Mars Sun
+ echo Sun
Sun
15:03:27
#vim for2
--- /tmp/l3-saved-2188.6549.22170	2010-01-12 16:03:28.000000000 +0200
+++ for2	2010-01-12 16:03:52.000000000 +0200
@@ -1 +1,3 @@
 #!/bin/bash
+set -x
+for i in `seq 1 100`
15:03:52
#seq 1 10
1
2
3
4
5
6
7
8
9
10
15:04:02
#seq 2 1 10
[root@debian1:tmp]# seq 1 10 2
1
2
3
4
5
6
7
8
9
10
15:04:07
#seq 1 2 10
1
3
5
7
9
15:04:43
#vim ~/.vimrc
--- /tmp/l3-saved-2188.12650.30067	2010-01-12 16:04:47.000000000 +0200
+++ /root/.vimrc	2010-01-12 16:05:05.000000000 +0200
@@ -1,7 +1,7 @@
 set number
 syntax on
 colorscheme evening
-set list
+"set list
 
 " An example for a vimrc file.
 "
15:07:01
#chmod +x for2
  3 for i in `seq 500 600`
  4 do
~   useradd -s /bin/bash -m user$i; echo user$i:password | chpasswd
  5 done
  6
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
"for2" 6L, 114C written
15:07:06
#./for2
+ chpasswd
+ for i in '`seq 500 600`'
+ useradd -s /bin/bash -m user564
+ echo user564:password
+ chpasswd
+ for i in '`seq 500 600`'
+ useradd -s /bin/bash -m user565
+ echo user565:password
+ chpasswd
+ for i in '`seq 500 600`'
...
+ echo user598:password
+ chpasswd
+ for i in '`seq 500 600`'
+ useradd -s /bin/bash -m user599
+ echo user599:password
+ chpasswd
+ for i in '`seq 500 600`'
+ useradd -s /bin/bash -m user600
+ echo user600:password
+ chpasswd
15:08:22
#[root@fbsd3:~]# cd /tmp
[root@debian1:tmp]# ssh 192.168.16.23
Password:
Last login: Tue Jan 12 14:29:02 2010 from 192.168.16.1
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
        The Regents of the University of California.  All rights reserved.
FreeBSD 6.3-RELEASE (SMP) #0: Wed Jan 16 04:45:45 UTC 2008
Welcome to FreeBSD!
Before seeking technical support, please use the following resources:
o  Security advisories and updated errata information for all releases are
   at http://www.FreeBSD.org/releases/ - always consult the ERRATA section
...
   http://www.FreeBSD.org/search/.  If the doc distribution has
   been installed, they're also available formatted in /usr/share/doc.
If you still have a question or problem, please take the output of
`uname -a', along with any relevant error messages, and email it
as a question to the questions@FreeBSD.org mailing list.  If you are
unfamiliar with FreeBSD's directory layout, please refer to the hier(7)
manual page.  If you are not familiar with manual pages, type `man man'.
You may also use sysinstall(8) to re-enter the installation and
configuration utility.  Edit /etc/motd to change this login announcement.
l3-agent is already running: pid=16277; pidfile=/root/.lilalo/l3-agent.pid
15:08:40
#[root@fbsd3:tmp]# vim for2
~
~
~
~
~
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
"for2" 1 line, 22 characters written
15:08:46
#[root@fbsd3:tmp]# vim for2
#!/usr/local/bin/bash
"for2" 1 line, 22 characters
15:09:01
#[root@fbsd3:tmp]# vim for2
~
~
~
~
~
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
"for2" 2L, 23C written
15:09:20
#[root@fbsd3:tmp]# jot - 1 100
[root@fbsd3:tmp]# man jot
JOT(1)                  FreeBSD General Commands Manual                 JOT(1)
NAME
     jot -- print sequential or random data
SYNOPSIS
     jot [-cnr] [-b word] [-w word] [-s string] [-p precision]
         [reps [begin [end [s]]]]
DESCRIPTION
     The jot utility is used to print out increasing, decreasing, random, or
     redundant data, usually numbers, one per line.
...
91
92
93
94
95
96
97
98
99
100
15:11:22
#[root@fbsd3:tmp]# chmod +x for2
    echo password | pw usermod user$i -h 0
~   done
  5
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"for2" 5L, 167C written
õ ×ÁÓ ÅÓÔØ ÎÏ×ÁÑ ÐÏÞÔÁ × /var/mail/root
15:11:53
#[root@fbsd3:tmp]# ./for2
+ pw user add user598 -s /usr/local/bin/bash -L russian -m -d /home/user598
+ echo password
+ pw usermod user598 -h 0
+ for i in '`jot - 500 600`'
+ pw user add user599 -s /usr/local/bin/bash -L russian -m -d /home/user599
+ echo password
+ pw usermod user599 -h 0
+ for i in '`jot - 500 600`'
+ pw user add user600 -s /usr/local/bin/bash -L russian -m -d /home/user600
+ echo password
+ pw usermod user600 -h 0
15:12:22
#[root@fbsd3:tmp]# cat for2
[root@fbsd3:tmp]# ssh 127.0.0.1 -l user555
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
DSA key fingerprint is 13:3f:fb:2a:53:62:8e:f8:0e:c7:3a:c9:10:99:b6:25.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '127.0.0.1' (DSA) to the list of known hosts.
Password:
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
        The Regents of the University of California.  All rights reserved.
FreeBSD 6.3-RELEASE (SMP) #0: Wed Jan 16 04:45:45 UTC 2008
Welcome to FreeBSD!
...
                -- Dru <genesis@istar.ca>
[user555@fbsd3 ~]$ exit
logout
Connection to 127.0.0.1 closed.
#!/usr/local/bin/bash
set -x
for i in `jot - 500 600`
do
pw user add user$i -s /usr/local/bin/bash -L russian -m -d /home/user$i;echo password | pw usermod user$i -h 0
done
15:12:59
#cat for1
[root@fbsd3:tmp]# exit
exit
Connection to 192.168.16.23 closed.
#!/bin/bash
set -x
for planet in Earth Moon Mars Sun
do
echo $planet
done
15:13:06
#cat for2
#!/bin/bash
set -x
for i in `seq 500 600`
do
useradd -s /bin/bash -m user$i; echo user$i:password | chpasswd
done
15:13:37
#vim for3
15:17:38
#ls /sbin/modinfo
/sbin/modinfo
15:17:44
#basename /sbin/modinfo
modinfo
15:17:59
#vim for3
--- /tmp/l3-saved-2188.23793.8600	2010-01-12 16:18:09.000000000 +0200
+++ for3	2010-01-12 16:18:35.000000000 +0200
@@ -1,4 +1,5 @@
 #!/bin/bash
+set -x
 FILES="
 /sbin/modinfo
 /sbin/ifconfig
@@ -10,4 +11,5 @@
 then echo "File $i not found";
 fi
 ls -lh $i | awk '{print $9" size: "$5}'
-
+whatis `basename $i`
+done
15:18:44
#./for3
[root@debian1:tmp]# chmod +x for3
+ FILES='
/sbin/modinfo
/sbin/ifconfig
/usr/bin/pinky
/sbin/sergey'
+ for i in '$FILES'
+ '[' '!' -e /sbin/modinfo ']'
+ ls -lh /sbin/modinfo
+ awk '{print $9" size: "$5}'
...
+ for i in '$FILES'
+ '[' '!' -e /sbin/sergey ']'
+ echo 'File /sbin/sergey not found'
File /sbin/sergey not found
+ ls -lh /sbin/sergey
ls: /sbin/sergey: No such file or directory
+ awk '{print $9" size: "$5}'
++ basename /sbin/sergey
+ whatis sergey
sergey: nothing appropriate.
15:19:36
#./for3
+ ls -lh /usr/bin/pinky
+ awk '{print $9" size: "$5}'
/usr/bin/pinky size: 20K
++ basename /usr/bin/pinky
+ whatis pinky
pinky (1)            - lightweight finger
+ for i in '$FILES'
+ '[' '!' -e /sbin/sergey ']'
+ echo 'File /sbin/sergey not found'
File /sbin/sergey not found
+ continue
15:20:00
#./for3
~
~
~
~
~
~
~
"for3" 16L, 232C written
/sbin/modinfo size: 11K
modinfo (8)          - program to show information about a Linux Kernel module
/sbin/ifconfig size: 58K
ifconfig (8)         - configure a network interface
/usr/bin/pinky size: 20K
pinky (1)            - lightweight finger
File /sbin/sergey not found
15:20:22
#vim select1
--- /dev/null	2010-01-09 19:22:11.915890422 +0200
+++ select1	2010-01-12 16:21:12.000000000 +0200
@@ -0,0 +1,2 @@
+#!/bin/bash
+
15:23:04
#cmod +x select1
  4         echo "You Lovely OS is: $os"
  5 done
  6 done
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"select1" 6L, 130C written
bash: cmod: command not found
15:23:12
#./select1
[root@debian1:tmp]# chmod +x select1
1) Mac OSx
2) Windows
3) Linux
4) FreeBSD
Please, choise you lovely OS4
You Lovely OS is: FreeBSD
Please, choise you lovely OS1
You Lovely OS is: Mac OSx
Please, choise you lovely OS2\
You Lovely OS is: Windows
Please, choise you lovely OS3
You Lovely OS is: Linux
Please, choise you lovely OS
15:23:56
#vim select1
--- /tmp/l3-saved-2188.25783.25477	2010-01-12 16:23:59.000000000 +0200
+++ select1	2010-01-12 16:24:07.000000000 +0200
@@ -1,5 +1,5 @@
 #!/bin/bash
-PS3='Please, choise you lovely OS'
+PS3='Please, choise you lovely OS: '
 select os in "Mac OSx" Windows Linux FreeBSD
 do
 	echo "You Lovely OS is: $os"
15:24:11
#arch\
[root@debian1:tmp]# ./select1
1) Mac OSx
2) Windows
3) Linux
4) FreeBSD
Please, choise you lovely OS: 4
You Lovely OS is: FreeBSD
>
i686
15:26:12
#arch
i686
15:26:42
#vim case1
--- /dev/null	2010-01-09 19:22:11.915890422 +0200
+++ case1	2010-01-12 16:28:05.000000000 +0200
@@ -0,0 +1,3 @@
+#!/bin/bash
+case `arch` in 
+i386) echo "Computer is on 80386 processor";;
15:29:46
#chmod +x case1
  3 i386) echo "Computer is on 80386 processor";
  4 i487) echo "Computer is on 80486 processor";
~    586) echo "Computer is on Pentium processor";
  6 i686) echo "Computer is on Pentium2 processor";
  7 *) echo "Computer is on unknown type of processor";
  8 esac
  9
~
~
~
...
~
~
~
~
~
~
~
~
~
"case1" 9L, 271C written
15:29:53
#./case1
./case1: line 4: syntax error near unexpected token `)'
./case1: line 4: `i487) echo "Computer is on 80486 processor";'
15:30:21
#./case1
  5 i586) echo "Computer is on Pentium processor";;
  6 i686) echo "Computer is on Pentium2 processor";;
  7 *) echo "Computer is on unknown type of processor";;
  8 esac
  9
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"case1" 9L, 276C written
Computer is on Pentium2 processor
15:30:29
#cat arch
[root@debian1:tmp]# arch
i686
cat: arch: No such file or directory
15:30:36
#cat case1
#!/bin/bash
case `arch` in
i386) echo "Computer is on 80386 processor";;
i487) echo "Computer is on 80486 processor";;
i586) echo "Computer is on Pentium processor";;
i686) echo "Computer is on Pentium2 processor";;
*) echo "Computer is on unknown type of processor";;
esac
15:31:15