Sponsored Content
Full Discussion: Using Perl Inside KSH
Top Forums Shell Programming and Scripting Using Perl Inside KSH Post 302357098 by jim mcnamara on Monday 28th of September 2009 05:04:35 PM
Old 09-28-2009
Code:
perl -e -'open (POSTSET, ">myfile");
print POSTSET $ARGV[0];
close (POSTSET);'  "$var"

Start with the above. You do know the shell can write to a file more efficiently than invoking perl like that?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

formatting textfile inside ksh script using awk not working

I cannot seem to get this text file to format. Its as if the awk statement is being treated as a simple cat command. I manned awk and it was very confusing. I viewed previous posts on this board and I got the same results as with the the awk command statement shown here. Please help. ... (6 Replies)
Discussion started by: tekline
6 Replies

2. Shell Programming and Scripting

expr inside a ksh script Solaris

Hi; If I do something like this. dftotalsize=0;export dftotalsize;df -k | grep \/db001 | awk '{print $4}' | while read theinput \ ; do export $theinput; dftotalsize=`expr $dftotalsize + $theinput`; export dftotalsize; echo $dftotalsize; done ; echo `expr $dftotalsize \/ 1024 \/ 1024 "GB" Is... (4 Replies)
Discussion started by: myjess
4 Replies

3. Shell Programming and Scripting

Exit statement ignored inside KSH function

Hi All, I have multiple functions in my script and I'm trying to capture stdout from some of them, but I also do some error checking in them (in the functions that output something to their stdout that needs capturing) and I need to be able to end the entire script with an error message. ... (2 Replies)
Discussion started by: gkubok
2 Replies

4. Shell Programming and Scripting

Using telnet inside a ksh

Hello, i am trying to use telnet inside of a ksh script. i would like to do like the following: #!/bin/ksh ... user="user" hostname="hostname" telnet -l $user $hostname |& wait #end of the ksh and with this piece of code, i would like to telnet another machine, and let the user use... (4 Replies)
Discussion started by: Jidma
4 Replies

5. Shell Programming and Scripting

Getting cntrl-c entered inside a ksh script

hi guys, my ksh script is calling another script. The other script expects user to press CNTR-C, and does not return to the prompt. in my script, I want to call the other script, but somehow don't want it to wait forever, I want to return to my script. e.g. script2.ksh outputs: "No... (2 Replies)
Discussion started by: JamesByars
2 Replies

6. Shell Programming and Scripting

How to call an sql script inside a while statement in KSH

Hi all, I'm trying to run an sql inside a loop which looks like this #!bin/ksh while IFS=, read var1 var2 do sqlplus -s ${USERNAME}/${PASSWORD}@${ORACLE_SID} << EOF insert into ${TABLE} ( appt_date ) values ( '${var1 }' ); ... (6 Replies)
Discussion started by: ryukishin_17
6 Replies

7. Shell Programming and Scripting

KSH SHELL: problem calculation number of lines inside compressed file

Hi Gurus, I am working with a korn shell script to simplify some operations of calculation number of lines inside compressed file. The called function (inside a cycle) is the following: ######################################### # F.ne: CheckCount #########################################... (3 Replies)
Discussion started by: GERMANICO
3 Replies

8. Shell Programming and Scripting

Using Sed to do a substitution inside ksh

I'm trying to do an ls from inside of a ksh script. I loop through the results one line at a time and attempt to do a substitution using sed to convert YYYYMMDD from the older files into the newer files. Basically sometimes the ETL load runs over midnight and half the files are off by one day... (3 Replies)
Discussion started by: Calbrenar
3 Replies

9. Shell Programming and Scripting

Return value inside isql to a shell variable in ksh

Hello, I have a shell script where I am doing an isql to select some records. the result i get from the select statement is directed to an output file. I want to assign the result to a Shell variable so that I can use the retrieved in another routine. e.g. "isql -U${USER} -P${PASSWD} -S${SERVER}... (1 Reply)
Discussion started by: RookieDev
1 Replies

10. Shell Programming and Scripting

sed command not working inside ksh script but works fine outside

Hi, I am a bit confused ,why would a sed command work fine outside of ksh script but not inside. e.g I want to replace all the characters which end with a value and have space at end of it. so my command for it is : sed -i "s/$SEPARATOR /$SEPARATOR/g" file_name This is working fine in... (8 Replies)
Discussion started by: vital_parsley
8 Replies
SmbHash(3)						User Contributed Perl Documentation						SmbHash(3)

NAME
Crypt::SmbHash - Perl-only implementation of lanman and nt md4 hash functions, for use in Samba style smbpasswd entries SYNOPSIS
use Crypt::SmbHash; ntlmgen SCALAR, LMSCALAR, NTSCALAR; DESCRIPTION
This module generates Lanman and NT MD4 style password hashes, using perl-only code for portability. The module aids in the administration of Samba style systems. In the Samba distribution, authentication is referred to a private smbpasswd file. Entries have similar forms to the following: username:unixuid:LM:NT Where LM and NT are one-way password hashes of the same password. ntlmgen generates the hashes given in the first argument, and places the result in the second and third arguments. Example: To generate a smbpasswd entry: #!/usr/local/bin/perl use Crypt::SmbHash; $username = $ARGV[0]; $password = $ARGV[1]; if ( !$password ) { print "Not enough arguments "; print "Usage: $0 username password "; exit 1; } $uid = (getpwnam($username))[2]; my ($login,undef,$uid) = getpwnam($ARGV[0]); ntlmgen $password, $lm, $nt; printf "%s:%d:%s:%s:[%-11s]:LCT-%08X ", $login, $uid, $lm, $nt, "U", time; ntlmgen returns returns the hash values in a list context, so the alternative method of using it is: ( $lm, $nt ) = ntlmgen $password; The functions lmhash and nthash are used by ntlmgen to generate the hashes, and are available when requested: use Crypt::SmbHash qw(lmhash nthash) $lm = lmhash($pass); $nt = nthash($pass); If Encoding is available (part of perl-5.8) the $pass argument to ntlmgen, lmhash and nthash must be a perl string. In double use this: use Crypt::SmbHash qw(ntlmgen lmhash nthash); use Encode; ( $lm, $nt ) = ntlmgen decode('iso-8859-1', $pass); $lm = lmhash(decode_utf8($pass), $pwenc); $nt = nthash(decode_utf8($pass)); The $pwenc parameter to lmhash() is optional and defaults to 'iso-8859-1'. It specifies the encoding to which the password is encoded before hashing. MD4 The algorithm used in nthash requires the md4 algorithm. This algorithm is included in this module for completeness, but because it is written in all-perl code ( rather than in C ), it's not very quick. However if you have the Digest::MD4 module installed, Crypt::SmbHash will try to use that module instead, making it much faster. A simple test compared calling nthash without Digest::MD4 installed, and with, this showed that using nthash on a system with Digest::MD4 installed proved to be over 90 times faster. AUTHOR
Ported from Samba by Benjamin Kuit <lt>bj@it.uts.edu.au<gt>. Samba is Copyright(C) Andrew Tridgell 1997-1998 Because this module is a direct port of code within the Samba distribution, it follows the same license, that is: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. perl v5.12.1 2004-10-17 SmbHash(3)
All times are GMT -4. The time now is 08:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy