Sponsored Content
Top Forums Shell Programming and Scripting Help for scripting sh / Add user auto Post 302423954 by alister on Sunday 23rd of May 2010 08:18:39 PM
Old 05-23-2010
How are you invoking autouser.sh? Exactly what are you typing? It looks like $1 is empty. Are you not passing an argument to the script?

Also, pseudocoder's advice regarding the whitespace is correct. The only reason you aren't seeing errors from that is because the redirection error aborts the script before it has a chance to execute those statements. (Nice catch, pseudocoder Smilie).

Regards,
Alister
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

freebsd auto login user at boot / i'm stuck

I run freebsd 4.8 and try to find the way or 'a' way to log in a certain user i created automaticaly at pc boot. I have searched the net, the manuals, but found nothing... could anyone please get me going by showing me an example or what file(s) i need to take a look at. i am not working... (6 Replies)
Discussion started by: termiEEE
6 Replies

2. Solaris

Auto Locking user accounts

Hi, I am trying to setup account locking in Solaris 9. I have made the changes in /etc/default/login where RETRIES=5 and SYSLOG_FAILED_LOGINS=5 and in /etc/user_attr I am having: test_user::::lock_after_retries=yes Still I am not able to lock test_user after successive unsuccessful... (1 Reply)
Discussion started by: run_time_error
1 Replies

3. AIX

AIX; Auto clearing of 'too many invalid login attempts by user'

Does anyone have a good script / cron job that handles this? I have looked in smit and see it is clearing this count with: chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s '{userid}' However when I looked around to find ways to automate this I have not found an easy... (0 Replies)
Discussion started by: Keith Johnson
0 Replies

4. Shell Programming and Scripting

auto login to Super User account

i want to write to script which will login to su account without hving user interaction.( i know Super user password) i wrote following script its also able to log into su account. but seesion gets terminates soon. what can be done ??? or is there any other solution. i don't want to use expect... (6 Replies)
Discussion started by: anup13
6 Replies

5. UNIX for Dummies Questions & Answers

scripting for user accounts info in UX

Hi guys, May I know how do I list out in UX for - all existing user accounts; sorted by activated/disabled - primary/sec groups of each user - date when the user accounts are created, - user last logon date - last password change date Anyone had done scripting for these info?... (0 Replies)
Discussion started by: doom10
0 Replies

6. UNIX for Dummies Questions & Answers

Scripting - process and user ids...Help please

Hello all: Working on a job I was asked get a simple script to perform the following task and would like to ask for some help. I'm looking forward to learning more and diving deeper into the World of Open Source servers. I need a script for a Unix server, using as few lines as possible, that... (4 Replies)
Discussion started by: moahten
4 Replies

7. Shell Programming and Scripting

Auto answer option in scripting.

Hi masters, How to get auto answer option in scripting. for example in my script i uses the gpg command , in that beginning it will ask passpharse : ( in that i need to type my passpharase) and once i typed it will ask Use this key anyway? ( for that answer will be yes) for... (1 Reply)
Discussion started by: anishkumarv
1 Replies

8. OS X (Apple)

Scripting User Account Removal

Ok, so I've been looking all over the place for how exactly to do this and I've become so bombarded with information I finally decided I'll pose the question here. I'm not a programmer or anything that hardcore, but if I see things already implemented and working examples I can easily learn and... (17 Replies)
Discussion started by: panacea
17 Replies

9. Red Hat

Auto Increasing Quota for User.

Hi, I would like to know wheather we can increase the quota for particular user automatically? I am having requirement to increase the quota only for 2 days in a week. but that shoule be automatically instead of manualy modification. is it possible? (3 Replies)
Discussion started by: manoj.solaris
3 Replies
catch(n)						       Tcl Built-In Commands							  catch(n)

__________________________________________________________________________________________________________________________________________________

NAME
       catch - Evaluate script and trap exceptional returns

SYNOPSIS
       catch script ?resultVarName? ?optionsVarName?
_________________________________________________________________

DESCRIPTION
       The  catch  command may be used to prevent errors from aborting command interpretation.	The catch command calls the Tcl interpreter recur-
       sively to execute script, and always returns without raising an error, regardless of any errors that might occur while executing script.

       If script raises an error, catch will return a non-zero integer value corresponding to the exceptional return code returned  by	evaluation
       of  script.  Tcl defines the normal return code from script evaluation to be zero (0), or TCL_OK.  Tcl also defines four exceptional return
       codes: 1 (TCL_ERROR), 2 (TCL_RETURN), 3 (TCL_BREAK), and 4 (TCL_CONTINUE).  Errors during evaluation of a script are indicated by a  return
       code of TCL_ERROR.  The other exceptional return codes are returned by the return, break, and continue commands and in other special situa-
       tions as documented.  Tcl packages can define new commands that return other integer values as return codes as well, and scripts that  make
       use of the return -code command can also have return codes other than the five defined by Tcl.

       If  the	resultVarName  argument  is given, then the variable it names is set to the result of the script evaluation.  When the return code
       from the script is 1 (TCL_ERROR), the value stored in resultVarName is an error message.  When  the  return  code  from	the  script  is  0
       (TCL_OK), the value stored in resultVarName is the value returned from script.

       If  the	optionsVarName	argument  is  given, then the variable it names is set to a dictionary of return options returned by evaluation of |
       script.	Tcl specifies two entries that are always defined in the dictionary: -code and -level.	When the return code  from  evaluation	of |
       script  is  not	TCL_RETURN, the value of the -level entry will be 0, and the value of the -code entry will be the same as the return code. |
       Only when the return code is TCL_RETURN will the values of the -level and -code entries be something else, as further described in the doc- |
       umentation for the return command.													   |

       When  the  return  code	from  evaluation  of script is TCL_ERROR, three additional entries are defined in the dictionary of return options |
       stored in optionsVarName: -errorinfo, -errorcode, and -errorline.  The value of the -errorinfo entry is a formatted stack trace	containing |
       more  information  about the context in which the error happened.  The formatted stack trace is meant to be read by a person.  The value of |
       the -errorcode entry is additional information about the error stored as a list.  The -errorcode value is meant to be further processed	by |
       programs,  and may not be particularly readable by people.  The value of the -errorline entry is an integer indicating which line of script |
       was being evaluated when the error occurred.  The values of the -errorinfo and -errorcode entries of the most recent error are also  avail- |
       able as values of the global variables ::errorInfo and ::errorCode respectively. 							   |

       Tcl packages may provide commands that set other entries in the dictionary of return options, and the return command may be used by scripts |
       to set return options in addition to those defined above.

EXAMPLES
       The catch command may be used in an if to branch based on the success of a script.
	      if { [catch {open $someFile w} fid] } {
		  puts stderr "Could not open $someFile for writing
$fid"
		  exit 1
	      }

       There are more complex examples of catch usage in the documentation for the return command.

SEE ALSO
       break(n), continue(n), dict(n), error(n), return(n), tclvars(n)

KEYWORDS
       catch, error

Tcl									8.5								  catch(n)
All times are GMT -4. The time now is 04:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy