alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (cpof)

This example Scala source code file (cpof) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

abs, abscmd, abscmd, applause, cpres, cpres, cpres:1, creates, len, len, ls, ls, thisdir, usage

The Scala cpof source code

#!/bin/sh
#
# Creates a classpath out of the contents of each directory
# given as an argument.

if [ $# == 0 ] ; then
  echo "Usage: $0 [dir1 dir2 ...]"
  exit 1
fi

THISDIR=`dirname $0`
ABSCMD="${THISDIR}/abspath"
CPRES=""

for dir in $* ; do
  absdir=`${ABSCMD} $dir`
  LS=`ls -1 ${absdir}`

  for x in $LS ; do
    ABS=`${ABSCMD} "${absdir}/${x}"`
    CPRES="${CPRES}:${ABS}"
  done
done

# shaving the : off the beginning.  Applause to /bin/sh for
# keeping us humble about how far we've come.
LEN=$(( ${#CPRES} - 1 ))
result=${CPRES:1:${LEN}}

echo $result

Other Scala examples (source code examples)

Here is a short list of links related to this Scala cpof source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.