swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possible unix faq entries


From: Rick Riolo
Subject: possible unix faq entries
Date: Mon, 25 Aug 1997 22:09:19 -0400 (EDT)

-------- alias command -----
Ginger brings up (indirectly) the alias command.
I find it very useful for making shortcuts for stuff I do
all the time, eg, an example ginger had:

alias pgrep 'ps -ef | grep '
alias hgrep 'history | grep '

The first is to find out whether some program is running
(eg to find out what the process id is so I can kill it!):

badger-rlr)pgrep emacs
     rlr  1085   950  2 21:58:43 ttyp7    0:00 grep emacs
     rlr  1009   946  0 08:58:37 ttyp6    0:07 emacs Notes-Series3.txt

The second is to find out exactly what command I entered
a while ago (without have to scroll or arrow-key back...this depends
on using a shell like tcsh which has a history command:

badger-rlr)hgrep wc
   191  15:20   wc Classifier/BasicCollec

===== makefile meets tar/gzip ===========================================
Using Makefile to tar-gzip and date things.
I use this instead of RCS for little projects for which
RCS seems like too much of a pain. 
I just include a ChangeLog.txt file to record my changes.
(yes, yes, I could use RCS, emacs, etc...something about
old dogs comes to mind here...)
Anyway, this does show how to get a date into file names
being slung around in a Makefile.

A part of a Makefile might be:
----------------
DATE=           `date +%y%m%d`
APPLICATION=sc01
COMPRESS=       gzip
UNCOMPRESS=     gunzip
Z_EXT=          gz

<...snip...>

save:
    tar cvf $(APPLICATION).tar *.txt Makefile *.m *.h *.c *.tcl *.pl 
    $(COMPRESS) $(APPLICATION).tar
    if [ ! -d Saves ]; then mkdir Saves; fi
    mv -i $(APPLICATION).tar.$(Z_EXT) Saves/$(APPLICATION)-${DATE}.tar.$(Z_EXT)
---------------- 
Entering
  make save
will result in a file
    Saves/sc01-970825.tar.gz
which has all the files matching the patterns shown on the tar command
(assuming I do it when the computer clock date is 970825).
Note it creates the Saves subdir if it doesn't exist already.
Thus I can save some daily work in a dated file, and have dated tar files
ready to ship out to other machines.

Also note by using the variables I can copy this Makefile for new projects
and then I usually just have to change the APPLICATION variable
(well, there is usually an OBJECTS variable too).

======================
- r

Rick Riolo                       address@hidden
Program for Study of Complex Systems (PSCS)
4068 Randall Lab     University of Michigan
Ann Arbor MI 48109-1120
http://pscs.physics.lsa.umich.edu/PEOPLE/rlr-home.html


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]