10 More Discussions You Might Find Interesting
1. AIX
I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. I do not want to assign user the same group of that directories too.... (0 Replies)
Discussion started by: blinkingdan
0 Replies
2. Shell Programming and Scripting
Hi, I am new to this forum.
I want to setup my personal Dropbox between my home server and the work station in the office.
I followed this tutorial
danbishop.org/2011/09/10/...-in-os-x-lion/and it works great. :)
The trouble now is I am not sure how I can make it to start on boot.
... (3 Replies)
Discussion started by: macpc
3 Replies
3. Shell Programming and Scripting
Dear Members,
I have a list of xml files like
abc.xml.table
prq.xml.table
...
..
.
in a txt file.
Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file.
Please help me with the script or command to do so.
... (11 Replies)
Discussion started by: Yoodit
11 Replies
4. Shell Programming and Scripting
Hello all,
First time posting, although the site has helped solve many problems in the past!
I would like to create a script to simplify a series of commands that I run:
Log into the ssh-server (RSA key)
ssh username@hostname -p 6110
Once there, I mount a truecrypt volume:
truecrypt... (3 Replies)
Discussion started by: freshtoast
3 Replies
5. Solaris
I have an automated testing script that relies on the dev box being able to see production's (NFS) share. It uses rsync and ssh to handle transfers and command execution; however, it also needs the production share mounted in order to run Perl code against it when Unix commands via ssh will not do.... (2 Replies)
Discussion started by: effigy
2 Replies
6. UNIX for Dummies Questions & Answers
I am very new to unix as well as shell scripting.
I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file
Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies
7. Shell Programming and Scripting
Hi everyone.
I have 3 machines, let's call them store, node1 and node2.
I have to mount on node1 and node2 the same directory of store.
So, I launch the sshfs command on node1 and everything works fine.
But when I try to do that on node2, it hangs for a while and then I obtain:... (0 Replies)
Discussion started by: canduc17
0 Replies
8. UNIX and Linux Applications
HI all, I got a CPIO archive that contains a unix filesystem that I try to extract, but it extract to the root dir / unstead of current dir, and happily it detects my file are newer otherwise it would have overwrited my system's file!
I tried all these commands
cpio -i --make-directories <... (2 Replies)
Discussion started by: nekkro-kvlt
2 Replies
9. Solaris
Hi, all..
Does Solaris 8 support sshfs? (Sorry if my question is too simple :o)
We are going to mount a file system from Solaris 8 on HP-UX 11i. Will things will go smoothly with this? Will there be any performance problem if the number of users grow to perform I/O operations on mounted fs?
... (4 Replies)
Discussion started by: swmk
4 Replies
10. Shell Programming and Scripting
hi all,
i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ...
specifically, i'd like to:
(1) specify a src directory
(2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs
(3) clone that same, empty dir hierarchy to... (2 Replies)
Discussion started by: OpenMacNews
2 Replies
bsearch(3C) bsearch(3C)
NAME
bsearch() - binary search a sorted table
SYNOPSIS
DESCRIPTION
is a binary search routine generalized from Knuth (6.2.1) Algorithm B. It returns a pointer into a table indicating where a datum may be
found. The table must be previously sorted in increasing order according to a provided comparison function. key points to a datum
instance to be sought in the table. base points to the element at the base of the table. nel is the number of elements in the table.
size is the size of each element in the table. compar is the name of the comparison function, which is called with two arguments that
point to the elements being compared. The function must return an integer less than, equal to, or greater than zero indicating that the
first argument (the key) is to be considered less than, equal to, or greater than the second argument (the array element).
NOTES
The pointers to the key and the element at the base of the table should be of type pointer-to-element, and cast to type pointer-to-void.
The comparison function need not compare every byte, so arbitrary data can be contained in the elements in addition to the values being
compared.
Although declared as type pointer-to-void, the value returned should be cast into type pointer-to-element.
RETURN VALUE
A NULL pointer is returned if the key cannot be found in the table.
EXAMPLES
The example below searches a table containing pointers to nodes consisting of a string and its length. The table is ordered alphabetically
on the string in the node pointed to by each entry.
This code fragment reads in strings and either finds the corresponding node and prints out the string and its length, or prints an error
message.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TABSIZE 1000
struct node { /* these are stored in the table */
char *string;
int length;
};
struct node table[TABSIZE]; /* table to be searched */
.
.
.
{
struct node *node_ptr, node;
/* routine to compare 2 nodes */
int node_compare(const void *, const void *);
char str_space[20]; /* space to read string into */
.
.
.
node.string = str_space;
while (scanf("%s", node.string) != EOF) {
node_ptr = (struct node *)bsearch((void *)(&node),
(void *)table, TABSIZE,
sizeof(struct node), node_compare);
if (node_ptr != NULL) {
(void)printf("string = %20s, length = %d
",
node_ptr->string, node_ptr->length);
} else {
(void)printf("not found: %s
", node.string);
}
}
}
/* This routine compares two nodes based on an
alphabetical ordering of the string field.
*/
int
node_compare(const void *node1, const void *node2)
struct node *node1, *node2;
{
return strcoll(((const struct node *)node1)->string,
((const struct node *)node2)->string);
}
WARNINGS
If the table being searched contains two or more entries that match the selection criteria, a random entry is returned by as determined by
the search algorithm.
SEE ALSO
hsearch(3C), lsearch(3C), qsort(3C), tsearch(3C), thread_safety(5).
STANDARDS CONFORMANCE
bsearch(3C)