Sponsored Content
Top Forums Shell Programming and Scripting users and groups /etc/group parsing Post 302522120 by verdepollo on Friday 13th of May 2011 10:49:32 AM
Old 05-13-2011
Quote:
there is possible in sh to create a function who return a boolean value?
You can use true or false commands:

Code:
[root@atlas /]# true
[root@atlas /]# echo $?
0
[root@atlas /]# false
[root@atlas /]# echo $?
1
[root@atlas /]#

Or use your own function:

Code:
function f(){
exit 0
}

Quote:
2)i have to verify if an user belongs to a group and i think it is needed to create a function which take two parameter and return a boolean value. in fact i have to parse /etc/group file and try to find out if my user (user taken from param1) belongs to group (group taken from param2). Any ideas? Thanks
Maybe something like this?

Code:
[root@atlas /]# groups root | grep -q wheel
[root@atlas /]# echo $?
0
[root@atlas /]# groups root | grep -q asdf
[root@atlas /]# echo $?
1
[root@atlas /]#

 

9 More Discussions You Might Find Interesting

1. Cybersecurity

Users and groups

Hi, Is it possible that one user belongs to many groups, or the relation of user/group is 1/1?. Thanks Ramón (2 Replies)
Discussion started by: rsanz
2 Replies

2. Linux

listing users and groups

RH 7.2 I'm trying to list the users & groups on my machine. I found the lsuser & lsgroup commands but no associated man pages. I typed: lsuser I get --> Valid options are: -a So I typed: lsuser -a I get --> Valid options are: groups, home So I typed: lsuser -a groups I get -->... (2 Replies)
Discussion started by: jalburger
2 Replies

3. UNIX for Dummies Questions & Answers

usermod -G and Group id login replacing existing groups

Hi all usermod -G Group_id login it is replacing the existiong Secoundry groups and is adding the only group speced in usermod command how can we retain the existing secoundry groups and add a user to a new group (6 Replies)
Discussion started by: pbsrinivas
6 Replies

4. UNIX for Dummies Questions & Answers

users and groups

hi eveyone i've recently requested my unix admin to create a userid for 2 groups. He created the id and i can see it by grep "id" /etc/group. But when i login with that id into unix and try to cd that group it says permission denied. something like cd /groupname -- permission denied Can my admin... (1 Reply)
Discussion started by: sammet
1 Replies

5. Solaris

Removing users from groups

How do I remove a user from a group? I'm using the usermod command but its not working. I have a user "abc" who is a member of the groups root and other. I'm trying to remove him from the group "other" (using CLI) which is his secondary group but it's not working. How do I do this? Is there any... (11 Replies)
Discussion started by: the_red_dove
11 Replies

6. UNIX for Dummies Questions & Answers

Group inside other groups

Hi How can I add a group1, group2 and group3 inside another global group called systemgroup? I have differents users in group1,2,3n and I create a sysgroup, now I want to add theses groups into the global.. is it possible? NOTE: Debian OS running. thanks (1 Reply)
Discussion started by: iga3725
1 Replies

7. UNIX for Dummies Questions & Answers

List users and groups

Hi I am new to unix so hopefully someone can help. I need to list all the users I have in my unix enviroment (AIX) and the groups (primary and secondary) they belong to. Can anyone help? Many thanks in advance (2 Replies)
Discussion started by: m3y
2 Replies

8. UNIX for Dummies Questions & Answers

Users in multiple groups?

Happy Thanksgiving Everyone!! I have a question about adding users to multiple groups. Thanks in advance Using Red Hat and here are the issues: Example: Users: Bob Mark Groups: SystemsAnalysts BusinessAnalysts If I am adding a user Bob to both groups (SystemsAnalysts and... (2 Replies)
Discussion started by: hansokl
2 Replies

9. UNIX for Advanced & Expert Users

Creating groups and users

Hi Could anyone please suggest how we can check in Linux if a user or a group name is already existing? In case of a user the command should also be able to specify the user with a given directory and shell. We can of course check this using a grep command but since that is just a pattern match,... (12 Replies)
Discussion started by: Dorothy
12 Replies
ATLASLABELER(1) 						   User Commands						   ATLASLABELER(1)

NAME
atlaslabeler - query stereotaxic atlases SYNOPSIS
atlaslabeler [OPTIONS] [input_file.nii.gz] OPTIONS
--version show program's version number and exit -v VERBOSE, --verbose=VERBOSE, --verbosity=VERBOSE Verbosity level of output -h, --help, --sos Show this help message and exit -a ATLASFILE, --atlas-file=ATLASFILE Atlas file to use. Overrides --atlas-path and --atlas --atlas-path=ATLASPATH Path to the atlas files. '%(name)s' will be replaced with the atlas name. See -A. Defaults depend on the atlas family. -A ATLASNAME, --atlas=ATLASNAME Atlas to use. Choices: HarvardOxford-Subcortical, Juelich, JHU-tracts, HarvardOxford-Cortical, MNI, talairach, Thalamus, talairach-dist -i INPUTCOORDFILE, --input-coordinates-file=INPUTCOORDFILE Fetch coordinates from ASCII file -o OUTPUTFILE, --output-file=OUTPUTFILE Output file. Otherwise standard output -d MAXDISTANCE, --max-distance=MAXDISTANCE When working with reference/distance atlases, what maximal distance to use to look for the voxel of interest -T TRANSFORMATIONFILE, --transformation-file=TRANSFORMATIONFILE First transformation to apply to the data. Usually should be subject -> standard(MNI) transformation -s, --summary Either to create a summary instead of dumping voxels. Use multiple -s for greater verbose summary --ss=SORTSUMMARYBY, --sort-summary-by=SORTSUMMARYBY How to sort summary entries. a-p sorts anteriorposterior order --dumpmap-file=DUMPMAPFILE If original data is given as image file, dump indexes per each treholded voxels into provided here output file -l LEVELS, --levels=LEVELS Indexes of levels which to print, or based on which to create a summary (for a summary levels=4 is default). To get listing of known for the atlas levels, use '-l list' --mni2tal=MNI2TALTRANSFORMATION Choose between available transformations from mni 2 talairach space --thr=LOWERTHRESHOLD, --lthr=LOWERTHRESHOLD, --lower-threshold=LOWERTHRESHOLD Lower threshold for voxels to output --uthr=UPPERTHRESHOLD, --upper-threshold=UPPERTHRESHOLD Upper threshold for voxels to output --abbr, --abbreviated-labels Manipulate with abbreviations for labels instead of full names, if the atlas has such -c, --tc, --show-target-coord Show target coordinates --tv, --show-target-voxel Show target coordinates --rc, --show-referenced-coord Show referenced coordinates/distance in case if we are working with reference atlas -C, --oc, --show-orig-coord Show original coordinates -V, --show-values Show values -I INPUTSPACE, --input-space=INPUTSPACE Space in which input volume/coordinates provided in. For instance Talairach/MNI -F, --forbid-direct-mapping If volume is provided it first tries to do direct mapping voxel-2-voxel if there is no transformation file given. This option for- bids such behavior and does coordinates mapping anyway. -t, --talairach Coordinates are in talairach space (1x1x1mm), otherwise assumes in mni space (2x2x2mm). Shortcut for '-I Talairach' -H, --half-voxel-correction Adjust coord by 0.5mm after transformation to Tal space. Please use -H to turn such adjustment off -r, --relative-to-origin Coords are relative to the origin standard form ie in spatial units (mm), otherwise the default assumes raw voxel dimensions --input-line-format=INPUTLINEFORMAT Format of the input lines (if ASCII input is provided) -R REFERENCELEVEL, --reference=REFERENCELEVEL Which level to reference in the case of reference atlas --prob-thr=PROBTHR At what probability (in %) to threshold in probabilistic atlases (e.g. FSL) --prob-strategy=PROBSTRATEGY What strategy to use for reporting. 'max' would report single area (above threshold) with maximal probabilitity EXAMPLES
bin/atlaslabeler -s -A talairach-dist -d 10 -R Closest Gray -l Structure,Brodmann area -cC mask.nii.gz produces a summary per each structure and brodmann area, for each voxel looking within 10mm radius for the closest gray matter voxel. atlaslabeler 0.4.8 April 2012 ATLASLABELER(1)
All times are GMT -4. The time now is 11:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy