This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ppd


Okay, some people have mentioned that I should explain
what I am trying to do with my csh script.  I think
this is true.  Basically, the script is called
ppd.txt, and I wrote it in Notepad.  ppd stands for
prepend.  The script will take a filename as its
argument and read from standard input.  Basically, it
takes input from something like:

2% (date; du ~) | ./ppd.txt ~/disk_storage&

The script takes the results of date and du and
appends them to the beginning of a file called
disk_storage.  Here is the script:

#!/bin/tcsh -x

#csh script to prepend standard input to file argument
#Version 1

#name temp file
set tf = /tmp/ppd.$$

#get argument name
set dest = "$argv[1]"

#copy standard input, $dest to $tf
cat - "$dest" > "$tf"

#replace original file
mv "$tf" "$dest"

With help from a lot of members of this digest (thank
you!), I have debugged it to the point where I do not
get any error messages.  However when I run the
command I mentioned earlier:

2% (date; du ~) | ./ppd.txt ~/disk_storage&

Nothing is prepended to disk_storage!  I created
disk_storage before running this script because I was
getting an error message when the script could not
find a file with that name.  Can anyone tell me what I
have done wrong?  Any suggestions on writing scripts
in cygwin would be appreciated, too!

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]