bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scripts one after the other


From: Quinn Fissler
Subject: Re: scripts one after the other
Date: Tue, 29 Mar 2016 09:56:27 +0100

On 26 March 2016 at 01:28, Val Krem <valkrem@yahoo.com> wrote:
>
> is it possible to combine the two scripts in one so that I can define the 
> varietals at one spot.  It would be less prone to error.


Yes - you can have a script with a "case" and hard link to another
name (you can symlink but they're not as efficient as hard links)


#!/bin/bash

# set your variables here.
F=foo
B=bar

case "$0" in
   "*1.sh")
      check your parameters for the first script...
      do stuff to create output | your_script_2.sh
   ;;
   "*2.sh")
      # some prog which reads input or read the input in bash
      while read Col1 Col2 Col3 RestOfLine
      do
         do your stuff - reading a line at a time lets you pick off
columns if needed...
      done
   ;;
   "*[!12].sh")
      echo We do not expect to be called $0
      exit
   ;;
esac



reply via email to

[Prev in Thread] Current Thread [Next in Thread]