02-28-2012
Booyah! I got it to work. Thank you.
I was able to make it work like this:
tempWordString1=${wordString[*]}
tempWordString2="${tempWordString1// /}"
and then testing if [ "$theWord" == "$tempWordString2" ]
I was not able to get it to work like this:
tempWordString="${${wordString[*]}// /}"
i tried playing with the syntax (pulling out $, adding " ")but couldn't get it to work. Is there a way to do parameter expansion directly on an array?
Again, thank you.
Last edited by lotsofideas; 02-28-2012 at 11:56 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I have a variable, on some machines it is '1024', which is fine, but on others it is '1024Mb' etc. I need this variable to simply be '1024', does anyone know how I could ensure this is always the case? Perhaps a command to remove any letters/characters that aren't integers if there is... (3 Replies)
Discussion started by: hodges
3 Replies
2. Shell Programming and Scripting
Hello experts,
(tcsh shell)
Quite new to shell scripting...
I have got a file with a single word on each line. Want to be able to make a comparison such that i can read pairs of words that are ROT13 to each other. Also, i would like to print the pairs to another file.
Any help... (5 Replies)
Discussion started by: Jatsui
5 Replies
3. UNIX for Dummies Questions & Answers
Hi Guys
i need to write a script to check the file structure
I have added the the file headers in the configuration file and execute the file at the start of the script.
Now the function
checkFileStructure()
{
echo "Inside the function"
filetocheck=$1
fileheader=$2
if ]
then... (1 Reply)
Discussion started by: Swapna173
1 Replies
4. Shell Programming and Scripting
Is there a way to compare the permission string of two files and output the string if they match?
For ex:
-rw-r--r-- 1 user newuser 0 2009-03-12 16:45 file2
-rw-r--r-- 1 user newuser 0 2009-03-12 16:46 fileone
output:
-rw-r--r--
If they don't match output will be just... (3 Replies)
Discussion started by: squardius
3 Replies
5. Shell Programming and Scripting
#!/bin/sh
PRINTF=/usr/bin/printf
MACHINE_NAME=`uname -n`
TIME=`date +"%H"`
$PRINTF "Welcome to $MACHINE_NAME. What is your name?\n"
read NAME
if ; then
$PRINTF "Good morning $NAME, how are you?\n"
elif ; then
$PRINTF "Good afternoon $NAME, how are you?\n"
else
$PRINTF "Good... (2 Replies)
Discussion started by: ikeQ
2 Replies
6. Shell Programming and Scripting
continuing from my previous post, whose link is given below as a reference
https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569
consider there is create table commands in a file for eg:
CREATE TABLE `Blahblahblah` (
`id` int(11) NOT NULL... (2 Replies)
Discussion started by: vivek d r
2 Replies
7. Shell Programming and Scripting
I have an for loop that reads the following file
cat param.cfg
val1:env1:opt1
val2:env2:opt2
val3:env3:opt3
val4:env4:opt4
.
.
The for loop extracts the each line of the file so that at any one point, the value of i is
val1:env1:opt1 etc...
I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies
8. Shell Programming and Scripting
Hi Experts,
I am finding difficulty to get exact match:
file
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
INTERFACE_NAME="lan3"
IP_ADDRESS="10.53.52.241"
SUBNET_MASK="255.255.255.192"
BROADCAST_ADDRESS=""
INTERFACE_STATE=""
DHCP_ENABLE=0
INTERFACE_NAME="lan3:1"... (6 Replies)
Discussion started by: rveri
6 Replies
9. Shell Programming and Scripting
I have the logic below to look up for matches within the columns between the two files with awk.
In the if statement is where the string comparison is attempted with ==
The issue seems to be with the operands, as
1. when " '${SECTOR}' " -- double quote followed by single quote -- awk matches... (1 Reply)
Discussion started by: deadyetagain
1 Replies
10. UNIX for Beginners Questions & Answers
I will start with an example of what I'm trying to do and then describe how I am approaching the issue.
File
PS028,005
Lexeme HRS # M #
PhraseType 1(1:1) 7(7)
PhraseLab 501 503
ClauseType ZYq0
PS028,005
Lexeme W # L> # BNH # M #... (17 Replies)
Discussion started by: jvoot
17 Replies
LEARN ABOUT NETBSD
workqueue_create
WORKQUEUE(9) BSD Kernel Developer's Manual WORKQUEUE(9)
NAME
workqueue -- simple do-it-in-thread-context framework
SYNOPSIS
#include <sys/workqueue.h>
int
workqueue_create(struct workqueue **wqp, const char *name, void (*func)(struct work *, void *), void *arg, pri_t prio, int ipl, int flags);
void
workqueue_enqueue(struct workqueue *wq, struct work *wk, struct cpu_info *ci);
void
workqueue_destroy(struct workqueue *wq);
DESCRIPTION
The workqueue utility routines are provided to defer work which is needed to be processed in a thread context.
workqueue_create() creates a workqueue. It takes the following arguments:
wqp Specify where to store the created workqueue.
name The name of the workqueue.
func The function to be called for each work.
arg An argument to be passed as a second argument of func.
prio The priority level for the worker threads.
ipl The highest IPL at which this workqueue is used.
flags The value of 0 indicates a standard create operation, however the following flags may be bitwise ORed together:
WQ_MPSAFE Specifies that the workqueue is multiprocessor safe and does its own locking, otherwise the kernel lock will be held while
work will be processed.
WQ_PERCPU Specifies that the workqueue should have a separate queue for each CPU, thus the work could be enqueued on concrete CPUs.
workqueue_enqueue() enqueues the work wk into the workqueue wq.
If the WQ_PERCPU flag was set on workqueue creation, the ci argument may be used to specify the CPU on which the work should be enqueued.
Also it may be NULL, then work will be enqueued on the current CPU. If WQ_PERCPU flag was not set, ci must be NULL.
The enqueued work will be processed in a thread context. A work must not be enqueued again until the callback is called by the workqueue
framework.
workqueue_destroy() destroys a workqueue and frees associated resources. The caller should ensure that the workqueue has no work enqueued
beforehand.
RETURN VALUES
workqueue_create() returns 0 on success. Otherwise, it returns an errno(2).
CODE REFERENCES
The workqueue subsystem is implemented within the file sys/kern/subr_workqueue.c.
SEE ALSO
callout(9), condvar(9), kthread(9), softint(9)
BSD
October 24, 2011 BSD