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
You can convert a number into a letter with:
echo -e \\octal, if you think this might help.
Joel
On Thu, Jan 31, 2002 at 11:32:47AM -0500, Ian wrote:
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
] = ${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
Here is a short script which will do what you want. Run it as:
scriptname letter
and see the magic.
#!/bin/bash
upletter ()
{
octal=`echo -n $L | od -A n -o`
new_octal=`echo obase = 8;ibase=8;$octal + 1 | bc`
L=`eval echo -e $new_octal`
}
L=$1
upletter
echo This is the new letter $L
Joel Hammer wrote:
Kurt W wrote stuff too
Thanks guys,
Both work well.
I just have to decide which fits into my script best when I head back to
work tomorrow.
--
Linux SxS [http://sxs.webhop.net/]
___
Linux-users mailing list -