Sponsored Content
Full Discussion: Bash Script issues
Top Forums Shell Programming and Scripting Bash Script issues Post 302519713 by agama on Wednesday 4th of May 2011 10:14:48 PM
Old 05-04-2011
This is a simple function that tests for non-alpha characters in a word. May not be the most efficient, but it does work.

Code:
# returns good (0) if the word contains only alpha chracters
function word_ok
{
        case $1 in 
                *[^a-zA-Z]*)    return 1;;   # return bad if word contains any non-alpha
        esac

        return 0
}

# example usage:
if word_ok $1
then
        echo "word is ok: $1"
else
        echo "word is bad: $1"
fi

Hope this helps.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

IP connection Bash script issues

Hello I need assistance with a bash script that needs to tell me whether in the last "x" days (which is a variable) anyone connected to the xxxx IP (which is another variable). Thank you! (1 Reply)
Discussion started by: Melchiah
1 Replies

2. Shell Programming and Scripting

for / foreach syntax issues (in bash or tcsh)

So I am new to unix, and actually anything outside drag and drop with the mouse (been learning for about a week so far) . I have been using the foreach command in tcsh because I am working on a group of files. Basically what I need is to insert part of the filename as the first line in the file.... (0 Replies)
Discussion started by: thepolypore
0 Replies

3. Shell Programming and Scripting

Bash script issues

Hi. The below part of my bash script kicks out the following error message: $ ./extract_eod_report_stats_new.sh 2010-04-23 ./extract_eod_report_stats_new.sh: line 204: syntax error near unexpected token `(' ./extract_eod_report_stats_new.sh: line 204: `TRANSACTIONS_RECEIVED_TOP=`grep... (6 Replies)
Discussion started by: Peter.Lovell
6 Replies

4. Shell Programming and Scripting

Bash: renaming file issues.

Hi, i want to rename a group of directories and files of my music, some items are like this: - , for directories. - , for files. I want to do something like this: , for directories. , for files. This is my code: #!/bin/bash for fname in *.mp3; do echo item: $fname mv... (2 Replies)
Discussion started by: josco1982
2 Replies

5. Shell Programming and Scripting

Unix bash script (mv issues);

Hey guys, I've registered here as I need urgent help. This is assignment for school and as you can see below I've completed the work. I'm simply stuck on one area. :wall: This script takes the first parameter (which is to be the new extension) and each parameter after that is a file... (1 Reply)
Discussion started by: Cynosure
1 Replies

6. Shell Programming and Scripting

Bash Script Issues (If statement for file copying)

Writing a bash script for use with Geektool, pulls the battery info, and shuffles images around so that an Image geeklet can display the correct expression as the desktop background. (Eventually I intend to make it more intricate, based on more variables, and add more expressions) I'm extremely... (1 Reply)
Discussion started by: The_Ardly374
1 Replies

7. Shell Programming and Scripting

Bash Case Issues..

Hi, I'm having some trouble with using "case...esac" in Bash. I've googled it and am stuggling to understand the syntax and how to do certain things. Firstly, I want to be able to choose a case based on a variable number For example, I have in my code a place where a user can enter... (2 Replies)
Discussion started by: Ste_Moore01
2 Replies

8. Shell Programming and Scripting

Bash/cron issues

Hi all, I am trying to run a cronjob to push my files to my git repo once a week and output a prompt to a logfile, my script works fine if I invoke it manually but my cronjob wont run for some reason, I have sourced the file, and restarted my Mac to no avail, right now I believe I have the cronjob... (8 Replies)
Discussion started by: gmenfan83
8 Replies

9. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

10. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
mlib_VideoColorRGBXint_to_ABGRint(3MLIB)		    mediaLib Library Functions			  mlib_VideoColorRGBXint_to_ABGRint(3MLIB)

NAME
mlib_VideoColorRGBXint_to_ABGRint - convert RGBX interleaved to ABGR interleaved SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> void mlib_VideoColorRGBXint_to_ABGRint(mlib_u32 *ABGR, const mlib_u32 *RGBX, const mlib_u8 *A_array, mlib_u8 A_const, mlib_s32 w, mlib_s32 h, mlib_s32 dlb, mlib_s32 slb, mlib_s32 alb); DESCRIPTION
The interleaved RGBX stream and the alpha values are combined into an interleaved A, B, G, R output stream. Within each 32-bit input pixel, the component ordering is R (bits 31-24), G (bits 23-16), and B (bits 15-8). Within each 32-bit output pixel, the component bordering is A (bits 31-24), B (bits 23-16), G (bits 15-8), and R (bits 7-0). The alpha values for this function work in the following fashion: if A_array is not NULL, the values are taken from the corresponding locations in the alpha array, otherwise a constant alpha value, specified by A_const, is store in each output pixel. Each element in the alpha array is an unsigned byte. w and h define the dimensions of the region of the buffers to be processed. The linebyte parameters are used to advance the data pointers for each of the buffers. PARAMETERS
The function takes the following arguments: ABGR Pointer to output buffer (word-aligned). RGBX Pointer to input buffer (word-aligned). A_array Pointer to array of alpha values (byte-aligned). A_const Constant alpha value (range = 0..255). w Image width in pixels. h Image height in lines. dlb Linebytes for output buffer. slb Linebytes for input buffer. alb Linebytes for alpha buffer. RETURN VALUES
None. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_VideoColorRGBseq_to_ABGRint(3MLIB), mlib_VideoColorRGBint_to_ABGRint(3MLIB), mlib_VideoColorBGRint_to_ABGRint(3MLIB), mlib_VideoColor- RGBXint_to_ARGBint(3MLIB), mlib_VideoColorXRGBint_to_ABGRint(3MLIB), mlib_VideoColorXRGBint_to_ARGBint(3MLIB), attributes(5) SunOS 5.11 2 Mar 2007 mlib_VideoColorRGBXint_to_ABGRint(3MLIB)
All times are GMT -4. The time now is 07:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy