Sponsored Content
Full Discussion: Question about Korn Shell
Top Forums Shell Programming and Scripting Question about Korn Shell Post 42808 by Perderabo on Tuesday 4th of November 2003 03:45:17 PM
Old 11-04-2003
if [ $ans = Y ] ; then
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question variables Korn

I'm using the following command to test for certain characters in a script echo "${1}" | grep '\$' if (( ${?} == 0 )) then testing this script on the command line I have ksh -x script1.sh "xxxx$xxxx" this works fine but when I want to use ksh -x script1.sh "xxxx $xxx" the... (1 Reply)
Discussion started by: frank
1 Replies

2. Shell Programming and Scripting

AWK question in the KORN shell

Hi, I have two files with the following content: gmrd.txt 235649;03;2563;598 291802;00;2563;598 314634;00;235649;598 235649;03;2563;598 393692;00;2563;598 411805;00;2563;598 411805;00;2563;598 235649;03;2563;598 414037;00;2563;598 575200;00;2563;598 70710;00;2563;598... (11 Replies)
Discussion started by: penfold
11 Replies

3. Shell Programming and Scripting

how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell.. #!/bin/ksh home=c:/..../ input=$1 sed '1,3d' $input > $1.out line="" cat $1.out | while read a do line="$line $a" done echo $line > $1 rm $1.out however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies

4. Shell Programming and Scripting

Korn Shell Loop question

I'm needing help with assigning variables inside a while loop of ksh script. I have an input text file and ksh script below and I'm trying to create a script which will read the input file line by line, assign first and second word to variables and process the variables according to the contents. ... (4 Replies)
Discussion started by: stevefox
4 Replies

5. Shell Programming and Scripting

Korn Shell Coprocess Performance Question

I am wracking my brains over this. I am trying to use a Korn Shell script to execute an Oracle PL/SQL procedure, using the Oracle command line interface (sqlplus). The script starts sqlplus in a coprocess, and the two processes communicate using a two-way pipe. The bgnice option is off, so both... (8 Replies)
Discussion started by: Mark Puddephat
8 Replies

6. Shell Programming and Scripting

korn shell question

Hi all, I am trying to tweak my ksh , i am running V: Version M-11/16/88i I have my Backspace and up/down arrows working using the following code in my ~/.profile file. set -o emacs alias __A=$(print '\020' ) alias __B=$(print '\016' ) alias __C=$(print '\006' ) alias __D=$(print... (4 Replies)
Discussion started by: mich_elle
4 Replies

7. Shell Programming and Scripting

Korn shell and awk question

I am modifying a Korn shell script in using the Exceed (Solaris 10 environment). My task is to read in a .txt file with dates arranged like this (01-Sep-2006). I am to read each line and take the dates, compare them to a benchmark date and depending on if it is older than the date or the date and... (6 Replies)
Discussion started by: mastachef
6 Replies

8. AIX

AIX 4.2 Korn shell and grep question

Ho do I find out the verion of the Kron shell on my client`s system ? There is no one to ask. They are not knowledged enough (hard to believe but yes). Also, on that AIX 4.2, I am trying to figure out how to do a grep using a search patter like below but does not seam to work. The '*' do... (11 Replies)
Discussion started by: Browser_ice
11 Replies

9. Shell Programming and Scripting

Question about a simple Korn script

Hi to everybody! I want to write a simple script in ksh that decrypts and encrypts using the DES algorithm. There is no builtin function in UNIX : i have found only a function in openssl but i don't understand how to use it. The script must accept in input the plaitext and the DESKEY in... (2 Replies)
Discussion started by: kazikamuntu
2 Replies

10. Shell Programming and Scripting

korn shell remove files question

how do you show each filename in a giving directory and delete the specific file in korn script i was thinking using ls rm ? but i cant make it work (0 Replies)
Discussion started by: babuda0059
0 Replies
PAM(3)							User Contributed Perl Documentation						    PAM(3)

NAME
Authen::PAM - Perl interface to PAM library SYNOPSIS
use Authen::PAM; $res = pam_start($service_name, $pamh); $res = pam_start($service_name, $user, $pamh); $res = pam_start($service_name, $user, &my_conv_func, $pamh); $res = pam_end($pamh, $pam_status); $res = pam_authenticate($pamh, $flags); $res = pam_setcred($pamh, $flags); $res = pam_acct_mgmt($pamh, $flags); $res = pam_open_session($pamh, $flags); $res = pam_close_session($pamh, $flags); $res = pam_chauthtok($pamh, $flags); $error_str = pam_strerror($pamh, $errnum); $res = pam_set_item($pamh, $item_type, $item); $res = pam_get_item($pamh, $item_type, $item); if (HAVE_PAM_ENV_FUNCTIONS()) { $res = pam_putenv($pamh, $name_value); $val = pam_getenv($pamh, $name); %env = pam_getenvlist($pamh); } if (HAVE_PAM_FAIL_DELAY()) { $res = pam_fail_delay($pamh, $musec_delay); $res = pam_set_item($pamh, PAM_FAIL_DELAY(), &my_fail_delay_func); } DESCRIPTION
The Authen::PAM module provides a Perl interface to the PAM library. The only difference with the standard PAM interface is that instead of passing a pam_conv struct which has an additional context parameter appdata_ptr, you must only give an address to a conversation function written in Perl (see below). If you want to pass a NULL pointer as a value of the $user in pam_start use undef or the two-argument version. Both in the two and the three-argument versions of pam_start a default conversation function is used (Authen::PAM::pam_default_conv). The $flags argument is optional for all functions which use it except for pam_setcred. The $pam_status argument is also optional for pam_end function. Both of these arguments will be set to 0 if not given. The names of some constants from the PAM library have changed over the time. You can use any of the known names for a given constant although it is advisable to use the latest one. When this module supports some of the additional features of the PAM library (e.g. pam_fail_delay) then the corresponding HAVE_PAM_XXX con- stant will have a value 1 otherwise it will return 0. For compatibility with older PAM libraries I have added the constant HAVE_PAM_ENV_FUNCTIONS which is true if your PAM library has the func- tions for handling environment variables (pam_putenv, pam_getenv, pam_getenvlist). Object Oriented Style If you prefer to use an object oriented style for accessing the PAM library here is the interface: use Authen::PAM qw(:constants); $pamh = new Authen::PAM($service_name); $pamh = new Authen::PAM($service_name, $user); $pamh = new Authen::PAM($service_name, $user, &my_conv_func); ref($pamh) || die "Error code $pamh during PAM init!"; $res = $pamh->pam_authenticate($flags); $res = $pamh->pam_setcred($flags); $res = $pamh->pam_acct_mgmt($flags); $res = $pamh->pam_open_session($flags); $res = $pamh->pam_close_session($flags); $res = $pamh->pam_chauthtok($flags); $error_str = $pamh->pam_strerror($errnum); $res = $pamh->pam_set_item($item_type, $item); $res = $pamh->pam_get_item($item_type, $item); $res = $pamh->pam_putenv($name_value); $val = $pamh->pam_getenv($name); %env = $pamh->pam_getenvlist; The constructor new will call the pam_start function and if successfull will return an object reference. Otherwise the $pamh will contain the error number returned by pam_start. The pam_end function will be called automatically when the object is no longer referenced. Examples Here is an example of using PAM for changing the password of the current user: use Authen::PAM; $login_name = getpwuid($<); pam_start("passwd", $login_name, $pamh); pam_chauthtok($pamh); pam_end($pamh); or the same thing but using OO style: $pamh = new Authen::PAM("passwd", $login_name); $pamh->pam_chauthtok; $pamh = 0; # Force perl to call the destructor for the $pamh Conversation function format When starting the PAM the user must supply a conversation function. It is used for interaction between the PAM modules and the user. The argument of the function is a list of pairs ($msg_type, $msg) and it must return a list with the same number of pairs ($resp_retcode, $resp) with replies to the input messages. For now the $resp_retcode is not used and must be always set to 0. In addition the user must append to the end of the resulting list the return code of the conversation function (usually PAM_SUCCESS). If you want to abort the con- versation function for some reason then just return an error code, normally PAM_CONV_ERR. Here is a sample form of the PAM conversation function: sub my_conv_func { my @res; while ( @_ ) { my $msg_type = shift; my $msg = shift; print $msg; # switch ($msg_type) { obtain value for $ans; } push @res, (0,$ans); } push @res, PAM_SUCCESS(); return @res; } More examples can be found in the Authen::PAM:FAQ. COMPATIBILITY
The following constant names: PAM_AUTHTOKEN_REQD, PAM_CRED_ESTABLISH, PAM_CRED_DELETE, PAM_CRED_REINITIALIZE, PAM_CRED_REFRESH are used by some older version of the Linux-PAM library and are not exported by default. If you really want them, load the module with use Authen::PAM qw(:DEFAULT :old); This module still does not support some of the new Linux-PAM functions such as pam_system_log. SEE ALSO
PAM Application developer's Manual, Authen::PAM::FAQ AUTHOR
Nikolay Pelov <NIKIP at cpan.org> COPYRIGHT
Copyright (c) 1998-2005 Nikolay Pelov. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.4 2005-06-30 PAM(3)
All times are GMT -4. The time now is 07:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy