Not sure if you after bash scripts that run J or hashbang scripts?

I've only recently started working mostly in Linux and with bash.
Here is an example of a hashbang script that I've created recently -
There are probably better ways to handle errors, I'd be interested in
alternative approaches and any other tips & tricks too.  Note that jc
is an alias to jconsole and that I've changed the default install path
from j64-701 to j64_701 in order to prevent J errors while executing
the first line.

==updateGSRinfo2map.jsh============================================
#!/usr/local/bin/jc

NB.# Convert the old-style GSR marker file (info) to the newer (map) style
NB.# =========================================================
NB.#
NB.#  This script creates a new-style "map" GSR marker file
NB.#  with the same set and order of markers as an existing
NB.#  old-style "info" GSR marker file that doesn't have Allele info
NB.#
NB.#  $1  filename of info format GSR marker file
NB.#  $2  filename for map format GSR marker file
NB.# [$3] optional filename for marker file to use as the Source
NB.#       Generally sourced from /data/annotation/
NB.#       defaults to use umd3-qamarkers-intersection-all.txt
NB.#
NB.#EG: $ ./updateGSRinfo2map.jsh myfile_marker-info.txt myfile_marker-map.txt

3 : 0 ''
 if. ((#ARGV)-2) -.@e. 2 3 do.
   echo 'Documentation for  ',": 1{::ARGV
   echo 2!:0 'grep ^NB\.\# ',": 1{::ARGV
   exit 1
 end.
)

require 'tables/dsv'

3 : 0 ''
try.
  'fninfo fnmap fnsrc'=: 3{.
2}.ARGV,<'/data/annotation/umd3-qamarkers-intersection-all.txt'
  (msg=:'Error: file(s) not found') assert fexist fninfo;fnsrc
  msg=: 'Error'
  info=: (' ';'') readdsv fninfo             NB. read old GSR info marker file
  src=: (' ';'') readdsv fnsrc               NB. read source marker file
  (msg=:'Error: Source marker file does not contain all markers in the
info file.') assert (3{"1 info) e. 1{"1 src
  map=: src {~ (1{"1 src) i. (3{"1 info)
  map writedsv fnmap;' ';''
catch.
  echo msg
  exit 1
end.
)
exit 0
================================================================

On Fri, Sep 30, 2011 at 3:17 AM, John Baker <[email protected]> wrote:
> I am in the process of converting a slew of windows batch scripts that
> employ jconsole.exe to linux bash scripts.
>
> It would be a big help to look at some examples.  If anyone out in J/linux
> land has some nice script examples they are willing to share please post.
>
> One good example > reams of documentation.
>
> --
> John D. Baker
> [email protected]
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to