RE: Incrementing Letter variables in bash

2002-01-31 Thread Wall, Kurt

This should give you an idea of how to proceed:

--- cut here ---
#!/bin/sh

# This creates an array consisting of lower case letters, indexed
# from 0
A=(a b c d e f g h i j k l m n o p q r s t u v w x y z)

# Index through the array
for (( i=0 ; $((i<=25)) ; $((i++)) ))
do
echo "A[$i] = ${A[$i]} "

done
echo
--- cut here---

$ ./x
A[0] = a
A[1] = b
A[2] = c
...
A[23] = x
A[24] = y
A[25] = z

Hope this helps.

Kurt
-Original Message-
From:   Ian [mailto:[EMAIL PROTECTED]]
Sent:   Thu 1/31/2002 11:32 AM
To: SxS-users
Cc: 
Subject:Incrementing Letter variables in bash
So far my searching hasn't turned up anything useful.

Is there a quick way to increment a letter variable in a bash script?

I am creating a script to automatically transfer files in a given
directory by creating a dated folder (mkdir $(date -I), copy files into
new folder and create a .log of the files using the output of 'ls'.

The issue here is that in order to stick to an existing convention, more
than one transfer in the same day has a '-a' or '-b' appended to the
directory and .log file names.

I've not been able to come up with a clever way to automatically
increment the letter to be appended, for example if '-a' has already
been taken for a given day.  It's not the checking part that I have
trouble with, it's incrementing a _letter_.

Before I create some ugly monstrosity of a loop to do this, can anyone
offer any hints?  Scripting has never been my strong suit...I can read
scripts quite well, but tend to "complexify" simple tasks due to lack of
experience.
-- 
Linux SxS [http://sxs.webhop.net]
___
Linux-users mailing list - http://linux.nf/mailman/listinfo/linux-users
Subscribe/Unsubscribe info, Archives,and Digests are located at the above URL.




<>

RE: Developer question

2002-01-30 Thread Wall, Kurt

Use autoconf.

Kurt


-Original Message-
From:   Rick Sivernell [mailto:[EMAIL PROTECTED]]
Sent:   Wed 1/30/2002 12:52 PM
To: [EMAIL PROTECTED]
Cc: 
Subject:Developer question
List

  I am doing a programming project for a college class. My system and the 
development system are both Linux. The final build & operation will be on
BSD, I do not at this time knowe version. My question is, if I create the
config &Makefile stuff on linux, how much rework to make my stuff work on 
BSD. My code will be generic not X or gnu specific, but use the standard headers
& stlport.

cheers

-- 
Rick Sivernell
Dallas, Texas  75287
972 306-2296
[EMAIL PROTECTED]
Caldera Open Linux eWorkStation 3.1
Registered Linux User

   .~.
  / v \
 /( _ )\
   ^ ^
In Linux we trust!
___
Linux-users mailing list - http://linux.nf/mailman/listinfo/linux-users
Subscribe/Unsubscribe info, Archives,and Digests are located at the above URL.




<>