Sponsored Content
Top Forums Shell Programming and Scripting execution of a string being echoed in bash Post 302582303 by ida1215 on Thursday 15th of December 2011 12:46:58 PM
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!
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
ppmdither(1)						      General Commands Manual						      ppmdither(1)

NAME
ppmdither - ordered dither for color images SYNOPSIS
ppmdither [-dim power] [-red shades] [-green shades] [-blue shades] [ppmfile] DESCRIPTION
Reads a portable pixmap as input, and applies dithering to it to reduce the number of colors used down to the specified number of shades for each primary. The default number of shades is red=5, green=9, blue=5, for a total of 225 colors. To convert the image to a binary rgb format suitable for color printers, use -red 2 -green 2 -blue 2. OPTIONS
-dim power The size of the dithering matrix. The dithering matrix is a square whose dimension is a power of 2. power is that power of 2. The default is 4, for a 16 by 16 matrix. -red shades The number of red shades to be used, including black; minimum of 2. -green shades The number of green shades to be used, including black; minimum of 2. -blue shades The number of blue shades to be used, including black; minimum of 2. SEE ALSO
pnmdepth(1), ppmquant(1), ppm(5) AUTHOR
Copyright (C) 1991 by Christos Zoulas. 14 July 1991 ppmdither(1)
All times are GMT -4. The time now is 11:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy