I want to learn to use the shell and was wondering why this didn't do as expected

Michael Havens plug-discuss@lists.plug.phoenix.az.us
Thu, 20 Feb 2003 13:06:54 -0700


[bmike1@localhost training]$ head -20 /etc/passwd >mypasswd

First I looked at what I had created.

[bmike1@localhost training]$ more mypasswd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/sh
daemon:x:2:2:daemon:/sbin:/bin/sh
adm:x:3:4:adm:/var/adm:/bin/sh
lp:x:4:7:lp:/var/spool/lpd:/bin/sh
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/bin/sh
news:x:9:13:news:/var/spool/news:/bin/sh
uucp:x:10:14:uucp:/var/spool/uucp:/bin/sh
operator:x:11:0:operator:/var:/bin/sh
games:x:12:100:games:/usr/games:/bin/sh
nobody:x:65534:65534:Nobody:/:/bin/sh
rpm:x:13:104:system user for rpm:/var/lib/rpm:/bin/false
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
xfs:x:70:70:system user for XFree86:/etc/X11/fs:/bin/false
rpc:x:71:71:system user for portmap:/:/bin/false
rpcuser:x:72:72:system user for nfs-utils:/var/lib/nfs:/bin/false
postfix:x:73:73:system user for postfix:/var/spool/postfix:/bin/false

Then I tried to sort it and look at the result.

[bmike1@localhost training]$ sort mypasswd |cat mypasswd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/sh
daemon:x:2:2:daemon:/sbin:/bin/sh
adm:x:3:4:adm:/var/adm:/bin/sh
lp:x:4:7:lp:/var/spool/lpd:/bin/sh
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/bin/sh
news:x:9:13:news:/var/spool/news:/bin/sh
uucp:x:10:14:uucp:/var/spool/uucp:/bin/sh
operator:x:11:0:operator:/var:/bin/sh
games:x:12:100:games:/usr/games:/bin/sh
nobody:x:65534:65534:Nobody:/:/bin/sh
rpm:x:13:104:system user for rpm:/var/lib/rpm:/bin/false
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
xfs:x:70:70:system user for XFree86:/etc/X11/fs:/bin/false
rpc:x:71:71:system user for portmap:/:/bin/false
rpcuser:x:72:72:system user for nfs-utils:/var/lib/nfs:/bin/false
postfix:x:73:73:system user for postfix:/var/spool/postfix:/bin/false

which I found was not sorted. So I thought that the sort had to be rewrit=
ten=20
to the file  and then I would look at it.

[bmike1@localhost training]$ sort mypasswd >mypasswd |cat mypasswd

which just returned the prompt.  Did I erase it? let's look at it.

[bmike1@localhost training]$ cat mypasswd

which gave me the prompt again. Why did it do this?
--=20
:-)~Mike~(-: