Thank you very much, I never thought of just taking that out!
For the completeness of this thread in case others are interested it has also been pointed out by someone on the other thread that all the way over on page *2* of the referenced thread there is a working script for this purpose, which also takes the path as command line arg.
Hi all,
I've been trying to get this to work for ages to no avail. I've searched this site and googled but cannot find a satisfactory answer.
I've got a while loop, like this
while read line
do
echo "$line"
done < file_name
Now, my problem is that most of the lines in the file... (3 Replies)
Hmmm... Bash doesn't parse whitespace with a read.
lev@sys09:~$ read line; echo "$line"
test
test
You can imagine what this does if you're using a shell script to read a list of unknown file names containing unknown spaces.
lev@sys09:~$ read word1 word2; echo "$word1,$word2"
123 456... (2 Replies)
I obviously haven't learned my lesson with shell and whitespace.
find /path/to/some/where/ -name "*.pdf" | awk '{print $5}'| uniq -d
results:
some Corporation
other Corporate junk
firmx
Works fine from cmdline but the whitespace turns into another FS in a for loop.
for... (7 Replies)
Hi,
I have a for loop which iterates over a list of strings, separated by whitespace:
$ list="1 2 3"
$ for i in $list; do echo $i; done
1
2
3
I now want to introduce some strings containing whitespace themselves ... This is straightforward if I directly iterate over the list:
$ for... (4 Replies)
I want to create a temp file which is named based on a search string. The search string may contain spaces or characters that aren't supposed to be used in filenames so I want to strip those out.
My thought was to use 'tr' with but the result is the opposite of what I want:
$ echo "test... (5 Replies)
Hi
Following is an example line.
echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:"
I want it's output to be
200
However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Daily stupid question. I want to increment the file name everytime the script is run. So for example if the filename is manager.log and I run the script, I want the next sequence to be manager.log1. So to be clear I only want it to increment when the script is executed. So
./script... (10 Replies)
Having issues with an expect script. I've been scripting bash, python, etc... for a couple years now, but just started to try and use Expect. Trying to create a script that takes in some arguments, and then for now, just runs a pwd command(for testing, final will be command I pass).
Here is... (0 Replies)
I am trying to do in a single line to take a list of paths separated by whitespace and then loop thru all the paths that were wrote but my regex is not working,
I have
echo {3} | sed 's/ //g' | while read EACHFILE
do
.....
But for some reason is only taking always the first path that I... (7 Replies)
Create a single bash script that does the following:
a. Print out the number of occurrences for each motif that is found in the bacterial genome and output to a file called motif_count.txt
b. Create a fasta file for each motif (so 3 in total) which contains all of the genes and their... (6 Replies)
Discussion started by: dre
6 Replies
LEARN ABOUT REDHAT
pthread_join
PTHREAD_JOIN(3) Library Functions Manual PTHREAD_JOIN(3)NAME
pthread_join - wait for termination of another thread
SYNOPSIS
#include <pthread.h>
int pthread_join(pthread_t th, void **thread_return);
DESCRIPTION
pthread_join suspends the execution of the calling thread until the thread identified by th terminates, either by calling pthread_exit(3)
or by being cancelled.
If thread_return is not NULL, the return value of th is stored in the location pointed to by thread_return. The return value of th is
either the argument it gave to pthread_exit(3), or PTHREAD_CANCELED if th was cancelled.
The joined thread th must be in the joinable state: it must not have been detached using pthread_detach(3) or the PTHREAD_CREATE_DETACHED
attribute to pthread_create(3).
When a joinable thread terminates, its memory resources (thread descriptor and stack) are not deallocated until another thread performs
pthread_join on it. Therefore, pthread_join must be called once for each joinable thread created to avoid memory leaks.
At most one thread can wait for the termination of a given thread. Calling pthread_join on a thread th on which another thread is already
waiting for termination returns an error.
CANCELLATION
pthread_join is a cancellation point. If a thread is canceled while suspended in pthread_join, the thread execution resumes immediately and
the cancellation is executed without waiting for the th thread to terminate. If cancellation occurs during pthread_join, the th thread
remains not joined.
RETURN VALUE
On success, the return value of th is stored in the location pointed to by thread_return, and 0 is returned. On error, a non-zero error
code is returned.
ERRORS
ESRCH No thread could be found corresponding to that specified by th.
EINVAL The th thread has been detached.
EINVAL Another thread is already waiting on termination of th.
EDEADLK
The th argument refers to the calling thread.
AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
SEE ALSO pthread_exit(3), pthread_detach(3), pthread_create(3), pthread_attr_setdetachstate(3), pthread_cleanup_push(3), pthread_key_create(3).
LinuxThreads PTHREAD_JOIN(3)