05-26-2009
Help with Kornshell Script
Hi,
I'm a novice at programming and need some help with a kornshell script I've been writting.
I have an inputdirectory with all my .shp files. In my input directory the shapefiles are named XXXX_original.shp, XXXX_UPDATE.shp ect.
In my .ksh script I have created a for loop which loops through all the files in the inputdirectory preforming a translation. Here is my code for my for loop.
for file in $InputDirectory/*.shp
do
*runs translation
done
This works fine, but I want to add a condition to my for loop. I only want my for loop to run when I have files which can be translated against each other. For example,
in my input directory I only want my loop to run when I have files XXXX_original.shp and XXXX_Update.shp ect. in the input directory.
I DO NOT want my for loop to run when I'm missing files. For example,
in my input directory I DO NOT want my loop to run when I have XXXX_original.shp and no corresponding XXXX_Update.shp. Or XXXX_Update.shp and NO XXXX_original.shp. Instead I could have a message box pop up with a message to the user.
Any help would be greatly appreciated.
Thanks,
Bryan
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I've been asked to upgrade from Kornshell 88 to Kornshell 93 on a Solaris 7 box. Since my experience with Unix is limited can anyone point me in the right direction? Specifically, where can I get the files that I need to do the upgrade? Thanks. (1 Reply)
Discussion started by: Ask Me
1 Replies
2. UNIX for Advanced & Expert Users
I have a KornShell script that has successfully been scheduled through Cron. We are in the process of changing over from Cron to using CA-Unicenter. To negative test the script I put a bad return code in. At the bottom of the script an e-mail is sent using mailx and then the return code is set... (1 Reply)
Discussion started by: Connie
1 Replies
3. Programming
Hello,
I'm currently doing some programming using the Kornshell environment. I have just been on a Unix course where our instructor gave us some coding examples. I am using one of these examples to solve a few problems.
However, the code examples use a function called 'convdate' to convert a... (10 Replies)
Discussion started by: nezster
10 Replies
4. Shell Programming and Scripting
I need a KornShell script that will, among all the users currently logged on to the system, find a slot of one hour that contains the most number of users. I know how to list all the users currently logged on but how do I do anything with the times that are listed? Please help, thanks. (1 Reply)
Discussion started by: ckrieger1
1 Replies
5. Shell Programming and Scripting
I am trying to write a Kornshell function that takes a string parameter which represents a filename or directory name. The function checks to see if there are any spaces in the filename or directory name and then replaces the spaces with an underscore. The returned value is a filename or directory... (1 Reply)
Discussion started by: ckrieger1
1 Replies
6. Shell Programming and Scripting
Hello everybody,
Is there any way to make a script (Bash, KornShell, etc.) executable
by mouse clicking?
For example you have a file myscript.sh, you run:
$ chmod u+x myscript.sh
Therefore it becomes executable and all you need is to run from
the terminal:
$./myscript.sh... (2 Replies)
Discussion started by: dariyoosh
2 Replies
7. Shell Programming and Scripting
Hello
Can someone help me to write a perl script or kornshell reading a two files and outputting to comma format.
Here is the two files
listofdisks.txt
id, diskname, diskgroup, diskisze(GB), FC
1, CN34, GRP1, 30, FC_CN34
2, CN67, GRP5, 19,
4, VD1, GRP4, 23, FC_VD1
6, CF_D1, ... (0 Replies)
Discussion started by: deiow
0 Replies
8. Shell Programming and Scripting
I have a script right now that I run a command which outputs just one word to a file. Well I need to grab that value and use it in another line of code so...
touch oraclesid.txt
echo $ORACLE_SID > oraclesid.txt
#grab that value
sqlplus v500/v500@<value>
how do I grab that value from the... (6 Replies)
Discussion started by: Blogger11
6 Replies
9. Shell Programming and Scripting
So Here is my code
cd $cer_mgr
table='hostname'
environment='echo $environment'
cat mq_$table_$environment_startup.ksh
I'm trying to make the results of the command "hostname" into a variable so that i can use it in my cat command. Well what I have is not working. So how do I use that... (1 Reply)
Discussion started by: Blogger11
1 Replies
10. Shell Programming and Scripting
Hi,
My environement
OS: Linux Fedora Core 17 X86_64
KSH version: sh (AT&T Research) 93u+ 2012-08-01
As I understand inside a Kornshell script, the getopts statement allows to collect information about the switches provided for the script (if any). Besides, it is possible to... (3 Replies)
Discussion started by: dariyoosh
3 Replies
LEARN ABOUT DEBIAN
dtk_create_string
DTK_CREATE_STRING(3) Draw Toolkit manual DTK_CREATE_STRING(3)
NAME
dtk_create_string - Creates or modify a shape to display a string
SYNOPSIS
#include <drawtk.h>
dtk_hshape dtk_create_string(dtk_hshape shp, const char *text,
float size, float x, float y,
unsigned int alignment,
const float *color, dtk_hfont font);
DESCRIPTION
dtk_create_string() creates a text specified by text at location (x,y) with a font size of size using a previously loaded font referenced
by font argument (see dtk_load_font(3)).
The position (x,y) is interpreted according to the combination of flags controlling the vertical and horizontal alignment defined in the
alignment argument:
* DTK_BOTTOM, DTK_VMID and DTK_TOP make the value y to be interpreted as respectively the bottom, the middle and the top of the bounding
box of the shape.
* DTK_LEFT, DTK_HMID and DTK_RIGHT make the value x to be interpreted as respectively the left, the middle and the right of the bounding
box of the shape.
shp and color has the same usage and meaning than in other shape creation functions (see dtk_create_shape(3)):
* shp can be used to modify a previously created shape. If it is non-null, the handle will be used to modify the shape referenced by shp:
no new shape is created and the returned value is ensured to be shp in case of success, NULL otherwise. If shp is NULL, the function
will attempt to create a new shape.
* color should point to a 4 float array containing a normalized RGBA value (i.e. each component is between 0.0 and 1.0).
RETURN VALUE
In case of success the function returns the handle to the newly created or modified shape. If the shp argument is non-null, the handle
returned is the same value. In case of error, NULL is returned.
SEE ALSO
dtk_load_font(3), dtk_create_shape(3)
EPFL
2010 DTK_CREATE_STRING(3)