delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/26/08:59:02

Message-ID: <915C65C50371D11187AD0000F881B9A401858CEF@bcarua62.ca.nortel.com>
From: "Ian Chapman" <Ian DOT Chapman DOT ichapman AT nt DOT com>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: Bash script
Date: Mon, 26 Oct 1998 08:56:09 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Hi dj pen pals,
        I've been working through some examples of sed and awk and met an
odd problem.  I've typed the script file byState and executed with
        "sed -f nameState list | byState" 
but it gave
        :- bash e:/djgpp/bin: Permission denied (EACCES)
So I did the sed half "sed -f nameState list > junk" and that did what I'd
expect from the book.

        Next I did "byState < junk" with a similar error. Then I got smart
and "source byState < junk" and that did what I expected.

        Well yes I'm using bash in a win95 dos window can it be made more
unix like without going to linx or whatever?  "ls -l" gives:-
total 6
-rwxr-xr-x   1 dosuser  dos           222 Oct 25 20:35 byState*
-rw-r--r--   1 dosuser  dos           427 Oct 24 23:49 junk
-rw-r--r--   1 dosuser  dos           350 Oct 24 22:27 list
-rw-r--r--   1 dosuser  dos             0 Oct 25 21:14 ls
-rw-r--r--   1 dosuser  dos           930 Oct 25 21:13 mail
-rw-r--r--   1 dosuser  dos           108 Oct 24 23:45 nameState
-rw-r--r--   1 dosuser  dos           108 Oct 24 22:33 sedscr

	To me byState looks to have executable permissions, don't know how
it got them.  Do rwx have any significance in my context or should I add
.bat to the script file.  "Chmod a=wrx byState" does not seem to do anything
to any of the above files.

        Regards Ian.

byState

#! e:/djgpp/bin
awk -F, '{
        print $4 ", "$0
        }' $* |
sort |
awk -F, '
$1 == LastState {
        print "\t" $2
}
$1 != LastState {
        LastState =$1
        print $1
        print "\t" $2
}'

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019