On Thu, 9 Dec 2004, Jacob Meuser wrote: [cut] > > I'm not a zsh user. But if you put the following into a file > > and make it executable it will work no matter what shell you > > normally use. > > yes, this will be a script. I am aware that there are differences > between the command line and a script, but I figured if it would > work on the command line, that would be a good first step :) > > > #!/bin/bash > > typeset -i tb=0 > > for file in *; do tb=$tb+$(wc -c < $file); done > > echo $tb > > well, that doesn't work with OpenBSD's /bin/sh.
No, it wouldn't. It is written for bash. With a small modification it will work with ksh. But Boring Shell isn't going to cut it. -- Allen Brown work: Agilent Technologies non-work: http://www.peak.org/~abrown/ [EMAIL PROTECTED] [EMAIL PROTECTED] In the course of my life, I have often had to eat my words, and I must confess that I have always found it a wholesome diet. --- Sir Winston Churchill > puff:~/ssm% echo $PATH > /home/jakemsr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin > puff:~/ssm% cat /home/jakemsr/bin/file-size > #!/bin/sh > > typeset -i bt=0 > > for file in * > do > tb=$tb+$(wc -c < $file) > done > > echo $tb > > exit 0 > puff:~/ssm% file-size > + 1887 + 1360 + 3756 > puff:~/ssm% ls -l > total 16 > -rw------- 1 jakemsr jakemsr 1887 Jun 17 20:45 43X.ssm > -rw------- 1 jakemsr jakemsr 1360 Jun 17 20:46 a_synth.ssm > -rw------- 1 jakemsr jakemsr 3756 Jun 17 20:46 carbohydrate.ssm > puff:~/ssm% > > > I'd rather rely on the existence of perl than bash ;/ > > > Well, actually, it has a defect. It doesn't behave correctly > > when $i is a directory. Do you need this to work recursively > > into subdirectories? > > no, not yet anyway. if needed, I could replace '*' with some `find` > invocation and then step into subdirectories manually. > > -- > <[EMAIL PROTECTED]> > _______________________________________________ > EUGLUG mailing list > [EMAIL PROTECTED] > http://www.euglug.org/mailman/listinfo/euglug > _______________________________________________ EUGLUG mailing list [EMAIL PROTECTED] http://www.euglug.org/mailman/listinfo/euglug
