|
Grex > Info > #9: An intro to some Unix commands (longish) | |
|
| Author |
Message |
popcorn
|
|
An intro to some Unix commands (longish)
|
Nov 10 04:39 UTC 1992 |
This item has been erased.
|
| 139 responses total. |
power
|
|
response 1 of 139:
|
Nov 11 01:23 UTC 1992 |
Wow! That must have taken some time to write up! Good job!
|
popcorn
|
|
response 2 of 139:
|
Nov 11 04:32 UTC 1992 |
This response has been erased.
|
kentn
|
|
response 3 of 139:
|
Dec 24 20:52 UTC 1992 |
Annoying Unix question of the day: I've been using trn to read usenet
news. Great. However, every time I quit trn, it saves a file called
'.oldnewsrc' which I always delete (to save disk space). Is there a
command to put in my .login or .cshrc that would check to see if
'.oldnewsrc' exists and if so, rm it? (I'd like this to be automatic).
|
robh
|
|
response 4 of 139:
|
Dec 24 22:57 UTC 1992 |
I just have a "nohup rm .oldnewsrc &" command in my .logout file.
If I haven't read any news during the session, big deal, it gives a
"file not found" error message and keeps on going.
|
power
|
|
response 5 of 139:
|
Dec 25 00:49 UTC 1992 |
Or another way is to put a
rm .newsrc
in your .logout file....
|
kentn
|
|
response 6 of 139:
|
Dec 25 07:00 UTC 1992 |
You mean rm .oldnewsrc...I *want* my .newsrc to hand around (I don't
want to go through three hours of it asking me if I want to add such
and such a newsgroup). I was hoping to find a way to do this that
avoids getting an error message when the file doesn't exist.
|
power
|
|
response 7 of 139:
|
Dec 25 20:49 UTC 1992 |
(oh yeah... Oh well, you know what I mean :) )...
putting the rm .oldnewsrc doesn't give an error message when there isn't
one, I don't think... (I almost always run trn when I get on, so I'm not
sure if I'd know, but I don't think I've noticed it doing so...)... Even
if it does, it would come right before the NO CARRIER message, so it's not
like it's really annoying... and you could always redirect it to /dev/null...
|
davel
|
|
response 8 of 139:
|
Dec 25 23:09 UTC 1992 |
If you're going to redirect it to /dev/null, I'm pretty sure it's 2>/dev/null
(stderr, not stdout).
(And either the redirection or a test for existence or a pre-creation is
indeed necessary if rm is not to give you a message. Would you settle for
a line
>.oldnewsrc
which would create the file if it didn't exist but cut it to 0 bytes if it
did, instead of (or before) the rm?)
|
kentn
|
|
response 9 of 139:
|
Dec 26 04:09 UTC 1992 |
(I don't know...whatever works, I'm just not sure how to do it without
getting an error).
|
davel
|
|
response 10 of 139:
|
Dec 26 11:27 UTC 1992 |
If you just do "rm .oldnewsrc" you'll get an error if it doesn't exist, but
as others noted the error shouldn't do any harm. If you just don't want
to see error messages, "rm .oldnewsrc 2>/dev/null" will send any error
messages down the black hole. This should be fine; in general I disapprove
a teeny little bit, as (if something truly weird were to happen) you wouldn't
see any other error messages either; but there *shouldn't* be any. Or you
can just wipe the thing down to nothing with "> .oldnewsrc", or create/wipe
it & *then* delete it with "> .oldnewsrc;rm .oldnewsrc".
Any of these should work and be acceptable.
|
kentn
|
|
response 11 of 139:
|
Dec 26 21:06 UTC 1992 |
Thanks, I'll give those ideas a try.
|
kentn
|
|
response 12 of 139:
|
Dec 27 04:12 UTC 1992 |
Well...my experiences have been: >.oldnewsrc gives an error about a bad
null (and doesn't create anything). rm will delete .oldnewsrc but not
without asking me if I want to (even when I use the -f switch). I tried
cp .newsrc .oldnewsrc and the rm .oldnewsrc, and that gives me a .oldnewsrc
to delete (although quite a bit bigger than 0 bytes!). the 2>/dev/null
gives me an error, as does >/dev/null (the latter hangs).
I pretty puzzled why rm -f doesn't work. Isn't -f supposed to override
the -i query?
If rm would work like it's supposed to I could probably learn to ignore
the error...
|
tsty
|
|
response 13 of 139:
|
Dec 27 08:34 UTC 1992 |
Whata it says inthe manual ...
NAME
rm, rmdir - remove (unlink) files or directories
SYNOPSIS
rm [ -r ] [ -f ] [ -i ] [ - ] _^Hf_^Hi_^Hl_^He_^Hn_^Ha_^Hm_^He ...
DESCRIPTION
Rm
_^Hr_^Hm removes (directory entries for) one or more files. If an
-f Force files to be removed without displaying permis-
sions, asking questions or reporting errors.
so kentn should expect rm to work as advertised, I would think ...
|
tsty
|
|
response 14 of 139:
|
Dec 27 08:36 UTC 1992 |
The only "error" I can think of would be if the file named did not
exist, then an error would be reported, but the manual tends to
say that nothing is reported if -f is used. Oh, well ...
it's unix.
|
davel
|
|
response 15 of 139:
|
Dec 27 18:59 UTC 1992 |
Hm. The null redirection apparently is only available in sh, not in csh.
(My apologies!!!).
I can't imagine what the problem with rm is, unless there are two versions
lurking on grex and your path is selecting the wrong one.
I would suggest that you do "type rm" to find out what you're getting, but
type is a builtin command in sh, & I don't think it works with csh. For me,
rm is /bin/rm.
To cut it down to zero bytes, you might try "cp /dev/null .oldnewsrc".
|
kentn
|
|
response 16 of 139:
|
Dec 28 01:42 UTC 1992 |
Well, I guess I could open a Bourne sh and do those commands, but that
might make logging out a major multi-step process. Anyway, I thought rm
was a part of Unix, not a part of the shell I'm using. Does some systems
person have the -f parameter locked out for some reason?
|
kentn
|
|
response 17 of 139:
|
Dec 28 06:41 UTC 1992 |
Here's another command question: where's tput? There's a man entry
for it, but I can't find it (or make it run).
|
robh
|
|
response 18 of 139:
|
Dec 28 22:37 UTC 1992 |
Kent - I have rm aliased in my .cshrc to 'rm -i', so it automatically
asks about deletions for every file. Could you have this set up?
|
glenda
|
|
response 19 of 139:
|
Dec 28 23:59 UTC 1992 |
Personally, I wouldn't remove .oldnewsrc. There have been times when,
for some reason, my .newsrc got munged and I needed .oldnewsrc to get back
into news without having to go through the whole list of groups and re-reading
the responses that I had already seen. Sort of like an insurance policy.
|
kentn
|
|
response 20 of 139:
|
Dec 29 02:55 UTC 1992 |
Well, since it takes up about 26K, I though I'd get rid of it to help
ease the disk crunch. If you people aren't worried about that, then
I'll leave it around. As an alternative, I could compress it, but then
I'd still have the problem of deleting .oldnewsrc.
I don't think I have rm aliased as you say, but even if I do, the
manuals (and man) say that rm -f overrides -i, so rm -fi means -f takes
precedence. Maybe I should just have .logout reply 'y'?
|
davel
|
|
response 21 of 139:
|
Dec 29 14:56 UTC 1992 |
I personally hope you'll figure out what's going on & let me know - things
like this suggest that other problems may crop up. (For one thing, what's
your path? if you don't mind posting it or mailing me.)
I assume you know it, but JIC: to do as you suggested:
echo y | rm .oldnewsrc
presumably ought to do it.
|
robh
|
|
response 22 of 139:
|
Dec 29 22:31 UTC 1992 |
Kent, perhaps the best option is to go through and delete the newsgroups
you're not reading from your .newsrc. When I did that, it went from
25K to 6K. That'll end up saving more space than rm'ing your
.oldnewsrc, and if you want, you can always do both.
|
kentn
|
|
response 23 of 139:
|
Dec 30 01:11 UTC 1992 |
Good idea, robh. I've been a bit leery of deleting something that I'll
later wish was there, so I haven't chopped the .newsrc down to size.
davel, I do have rm aliased as 'rm -i'. I'll try unaliasing it and see
if the -f switch works. If it does, then I'll be annoyed that it should
work even if rm is aliased... I think my path is okay, at least rm is
working fine, except for the questioning I get from -i. I'd really like
to leave -i in the alias because I do from time to time delete things
without thinking.
|
davel
|
|
response 24 of 139:
|
Dec 30 02:24 UTC 1992 |
Thanks - I am glad to believe that the alias is the cause; I just would
have hated to find rm itself behaving in inconsistent ways.
|