execution of a string being echoed in bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting execution of a string being echoed in bash
Prev   Next
# 1  
Old 12-15-2011
execution of a string being echoed in bash

hi all, I am trying to do a loop on a series of plotting function shown below:

Code:
colorlist=(blue red green); n=0;
for k in $xy; do
     psbasemap $range -JM$scale -B10g5 -X1 -Y1 -P -K > $outfile
     pscoast $range -JM$scale -B10g5 -D$res -P -W$lwidth -G$fill -O -K >> $outfile
     echo "psxy $k $range -JM$scale -B10g5 -Sc0.05 -P -G${colorlist[n++]} -O -K >> $outfile"
 done

I want to execute the command string being echoed and that for the last file to be executed within the list, it will omit the -K option. I need to run it like this sample code below:
Code:
psxy 1999.dat -R$range -JM$scale -P -M -Sc0.1 -Gblue -K -O >> $outfile
psxy 2000.dat -R$range -JM$scale -P -M -Sc0.1 -Gred -K -O >> $outfile
psxy 2001.dat -R$range -JM$scale -P -M -Sc0.1 -Ggreen -O >> $outfile

bunch of thanks!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH Execution Delay / Speedup

I have a BASH script that runs a continuous loop, reading a line from a file, and then spawning a background process to use it. I've placed "date" commands inside it to see where it's slowing down, and everything inside -- including reading the line from the file -- is fast, but the loop bogs... (34 Replies)
Discussion started by: gmark99
34 Replies

2. Shell Programming and Scripting

Why execution is different from orginal bash registry$database?

Hi all, here's my script #!/bin/ksh if then export DB_CREATE_PATH=`pwd` fi echo echo "********************--Menu--*****************************" echo "*** " echo "*** 1. Pre-Upgrade Steps "... (3 Replies)
Discussion started by: jediwannabe
3 Replies

3. Programming

PHP Echoed in Ajax

I have built a site in PHP for radio station, and the daily schedule is displayed dynamically using PHP script. I have added links to view different days but when it loads up its just loading up a new page. I can't quite remember how I done it but I'd like it to be in ajax if that's... (2 Replies)
Discussion started by: AimyThomas
2 Replies

4. Shell Programming and Scripting

How to simulate an execution queue with bash?

I'm running cygwin bash on windows 7 and I'm have some bat files that perform large builds and take a long time and a lot of memory. Therefor, I don't want to builds executing simultaneously (too much memory). How can I implement a queue so I can queue up multiple builds and only execute one... (2 Replies)
Discussion started by: siegfried
2 Replies

5. Shell Programming and Scripting

Execution problems with BASH Shell Script

Hi I need help with my coding , first time I'm working with bash . What i must do is check if there is 3 .txt files if there is not 3 of them i must give an error code , if al three is there i must first arrange them in alphabetical order and then take the last word in al 3 of the .txt files... (1 Reply)
Discussion started by: linux newb
1 Replies

6. Shell Programming and Scripting

Execution Problems with bash script

Hello, can someone please help me to fix this script, I have a 2 files, one file has hostname information and second file has console information of the hosts in each line, I have written a script which actually reads each line in hostname file and should grep in the console file and paste the... (8 Replies)
Discussion started by: bobby320
8 Replies

7. Shell Programming and Scripting

execution time / runtime -- bash script please help!

Hello, I'm running a bash script and I'd like to get more accurate a runtime information then now. So far I've been using this method: STARTM=`date -u "+%s"` ......... *script function.... ......... STOPM=`date -u "+%s"` RUNTIMEM=`expr $STOPM - $STARTM` if (($RUNTIMEM>59)); then... (6 Replies)
Discussion started by: TehOne
6 Replies

8. UNIX for Dummies Questions & Answers

Putting echoed text into a new file

Hi, I've set up a script so that a user answers questions, and then these answers come back onto the screen accompanied by text that I've echoed. Is there a way of putting this into a new file? Thanks (7 Replies)
Discussion started by: likelylad
7 Replies

9. Shell Programming and Scripting

bash script execution with a variable in a single line

Let a script needs a variable to execute. For example if i run ./test.sh then it needs a variable as there is a <STDIN> in the script. I want to execute it as in command line. Let test.sh requires a variable name $number I want to execute it by >test number <enter> how is it possible? (1 Reply)
Discussion started by: shoeb
1 Replies

10. Shell Programming and Scripting

echoed prompt not appearing until after read command.

I have a script I am runing on a hacked CDLinux live CD called from /etc/rc.d/rc.local. The part of th script in question goes like this. When run from rc.local the prompt "Centre name :" and the colour change does not appear until after I type the input text and press return. Also, I... (2 Replies)
Discussion started by: simonb
2 Replies
Login or Register to Ask a Question
GLCOLORMASK(3G) 														   GLCOLORMASK(3G)

NAME
glColorMask - enable and disable writing of frame buffer color components C SPECIFICATION
void glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) PARAMETERS
red, green, blue, alpha Specify whether red, green, blue, and alpha can or cannot be written into the frame buffer. The initial values are all GL_TRUE, indicating that the color components can be written. DESCRIPTION
glColorMask specifies whether the individual color components in the frame buffer can or cannot be written. If red is GL_FALSE, for exam- ple, no change is made to the red component of any pixel in any of the color buffers, regardless of the drawing operation attempted. Changes to individual bits of components cannot be controlled. Rather, changes are either enabled or disabled for entire color components. ERRORS
GL_INVALID_OPERATION is generated if glColorMask is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_COLOR_WRITEMASK glGet with argument GL_RGBA_MODE SEE ALSO
glClear(3G), glColor(3G), glColorPointer(3G), glDepthMask(3G), glIndex(3G), glIndexPointer(3G), glIndexMask(3G), glStencilMask(3G) GLCOLORMASK(3G)