Sponsored Content
Full Discussion: Test....
Top Forums UNIX for Dummies Questions & Answers Test.... Post 302165838 by reborg on Saturday 9th of February 2008 10:14:36 AM
Old 02-09-2008
Quote:
Originally Posted by ennstate
Code:
ypcat passwd | grep -i <user>

That's an extremely poor way of looking for a user, which is completly dependent on a NIS based environment.

Code:
getent passwd <username> > /dev/null 2>&1
if [[ $? -eq 0 ]] ;then
   echo "user exists"
else
   echo "user does not exist"
fi

 

5 More Discussions You Might Find Interesting

1. Solaris

test and .test in same directory

i am using solaris 5.10. i can create two different files "test" and ".test" in the same directory. now suppose i want to change the attribute of the hidden file .test to visible is it possible??? since "." is just an attribute to mark a file hidden why is unix allows creation of "file" and... (14 Replies)
Discussion started by: vikashtulsiyan
14 Replies

2. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

3. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

4. Shell Programming and Scripting

Prefixing test case methods with letter 'test'

Hi, I have a Python unit test cases source code file which contains more than a hundred test case methods. In that, some of the test case methods already have prefix 'test' where as some of them do not have. Now, I need to add the string 'test' (case-sensitive) as a prefix to those of the... (5 Replies)
Discussion started by: royalibrahim
5 Replies

5. Shell Programming and Scripting

Shc : trying to test functionality "test" compiling but can not execute

I am testing shc to see if it would help with my need. Im at a point where Im trying to compile and test the "test.ksh" file that comes in the tar ball : shc-3.8.9> shc -v -r -f test.ksh shc shll=ksh shc =-c shc =exec '%s' "$@" shc = shc opts= shc: cc test.ksh.x.c -o test.ksh.x... (7 Replies)
Discussion started by: popeye
7 Replies
Test::Unit::Result(3pm) 				User Contributed Perl Documentation				   Test::Unit::Result(3pm)

NAME
Test::Unit::Result - unit testing framework helper class SYNOPSIS
This class is not intended to be used directly DESCRIPTION
This class is used by the framework to record the results of tests, which will throw an instance of a subclass of Test::Unit::Exception in case of errors or failures. To achieve this, this class gets called with a test case as argument. It will call this test case's run method back and catch any excep- tions thrown. It could be argued that Test::Unit::Result is the heart of the PerlUnit framework, since TestCase classes vary, and you can use one of sev- eral Test::Unit::TestRunners, but we always gather the results in a Test::Unit::Result object. This is the quintessential call tree of the communication needed to record the results of a given test: $aTestCase->run() { # creates result $aTestResult->run($aTestCase) { # catches exception and records it $aTestCase->run_bare() { # runs test method inside eval $aTestCase->run_test() { # calls method $aTestCase->name() # and propagates exception # method will call Assert::assert() # to cause failure if test fails on # test assertion # it finds this because $aTestCase is-a Assert } } } } Note too that, in the presence of Test::Unit::TestSuites, this call tree can get a little more convoluted, but if you bear the above in mind it should be apparent what's going on. AUTHOR
Copyright (c) 2000-2002, 2005 the PerlUnit Development Team (see Test::Unit or the AUTHORS file included in this distribution). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
o Test::Unit::Assert o Test::Unit::TestCase o Test::Unit::Exception perl v5.8.8 2006-09-13 Test::Unit::Result(3pm)
All times are GMT -4. The time now is 08:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy