Looping structure to make up for lack of bash GOTO
Hello,
I am re-processing some files when a specific condition is met. The condition is read from the filename. Since files may need to be re-processed a number of times before they no longer meet the condition, I need to know when to stop re-processing. I am having trouble visualizing the proper control structure. What I had in mind was something like,
The above code would nicely keep looping until there were no compliment files found. The somewhat annoying lack of a GOTO statement makes takes this option off of the table, so I need a replacement.
I guess that some kind of a while loop would be the best alternative, but I don't know what bash has to offer for loops other than a do loop.
Can someone make a suggestion for this. I can post more code if that would help.
---------- Post updated at 10:25 PM ---------- Previous update was at 08:44 PM ----------
At the moment, I am trying something like this,
As far as I can tell, this will re-process all files that need it. Re-processing will create a new set of file names. The code will loop back to check the new set of file names to see if anything still needs to be re-processed. The code will keep looping until no file names are found that need to be re-processed.
I still seem to be incapable of writing code without multiple nested loops.
Hi,
I'm a novice and I'd like to make a directory structure with a hundred or so folders. I've tried mkdir /foo/foo1/etc...
mkdir /foo/foo2/etc
mkdir /foo/foo3/etc
mkdir /foo/foo4/etc
...but it appends '@' to each folder name and then fails on the subdirectories. Is it better to use a... (2 Replies)
hello every one this is my first post ... well i'm new to linux ....
i've been enjoying shell scripting tutorials and i'm new to writting scripts
i want to write a script that creates a directory tree named in hexadecimal but i'm stuck at the hexadecimal part ... here is my code (incase i... (2 Replies)
i want to write a script that creates a directory tree named in hexadecimal but i'm stuck at the hexadecimal part ... here is my code (incase i was dealing with intergers ...using bash)
max=39
for((i=1;i<=max;i++))
do
mkdir $i
cd $i
done
i have tried using "typeset i16 i" but... (7 Replies)
hi,
i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
Does anyone have a same of a bash script that cd to a directory and execute a cgi script then moves onto the next directory then executes another cgi ? (3 Replies)
Hello,
I have a database file, named data.txt, and a shell script (convert.sh) to convert data.txt from columns to row. Output file name will be column_to_row.txt
In this example data.txt has only four rows.
Format of data.txt is:
info name surname telefon_nr
Data.txt
info boris... (1 Reply)
In the bash below I am trying to run the script entire script including the ....(which is a bunch of code) and then in the run function if the user response is y (line in bold). then start processing from execute function. Basically, goto the # extract folder for variable filename line and start... (4 Replies)
Hello guys,
I want to parse a JSON file in order to get the data in a table form.
My JSON file is like this:
{
"document":{
"page":
},
{
"column":
}
]
},
{
... (6 Replies)
]I would like to make the second file label 'b' print down the first file label 'a', like shifting down the file creating new lines I want it to print all the way down until the first line of the second file hit the last line of the first file. Would I have to put this into a file itself or could I... (24 Replies)
Well, guys I saw a question about GOTO for Python.
So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too).
Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'...
This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies
LEARN ABOUT HPUX
pthread_condattr_init
pthread_condattr_init(3T)pthread_condattr_init(3T)NAME
pthread_condattr_init(), pthread_condattr_destroy() - initialize or destroy a condition variable attributes object.
SYNOPSIS PARAMETERS
attr Pointer to the condition variable attributes object to be initialized or destroyed.
DESCRIPTION
initializes the condition variable attributes object attr with the default values for all attributes. The attributes object describes a
condition variable in detail and is passed to the condition variable initialization function.
When a condition variable attributes object is used to initialize a condition variable, the values of the individual attributes determine
the characteristics of the new condition variable. Attributes objects act like additional parameters to object initialization. A single
attributes object can be used in multiple calls to the function
When a condition variable is initialized with an attributes object, the attributes are, in effect, copied into the condition variable.
Consequently, any change to the attributes object will not affect any previously initialized condition variables. Once all condition vari-
ables needing a specific attributes object have been initialized, the attributes object is no longer needed.
The condition variable attributes and their default values are:
The default value is
If an initialized condition variable attributes object is reinitialized, undefined behavior results.
destroys the condition variable attributes object attr. The destroyed condition variable attributes object ceases to exist and its
resources are reclaimed. Using attr after it has been destroyed results in undefined behavior. A destroyed condition variable attributes
object can be reinitialized using the function
Condition variables that have been already initialized using this attributes object are not affected by the destruction of the condition
variable attributes object.
RETURN VALUE
Upon successful completion, and return zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the function returns the corresponding error number:
[ENOMEM] There is insufficient memory available in which to initialize the condition variable attributes object.
[EINVAL] attr is not a valid condition variable attributes object.
For each of the following conditions, if the condition is detected, the function returns the corresponding error number:
[EINVAL] attr is not a valid condition variable attributes object.
AUTHOR
and were derived from the IEEE POSIX P1003.1c standard.
SEE ALSO pthread_create(3T), pthread_condattr_getpshared(3T), pthread_cond_init(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_condattr_init(3T)