02-08-2010
Passing command line argument between shell's
Hi,
I am facing a problem to pass command line arguments that looks like
<script name> aa bb "cc" dd "ee"
I want to pass all 5 elements include the " (brackets). when I print the @ARGV the " disappear. I hope I explain myself
Regards,
Ziv
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to unix. Is their a way to pass the output of the line below to a variable var1.
ls -1t | head -1.
I am trying something like var1=ls -1t | head -1, but I get error.
Situation is: I get file everyday through FTP in my unix box. I have to write a script that picks up first... (1 Reply)
Discussion started by: rkumar28
1 Replies
2. Shell Programming and Scripting
I have a shell script which does the encryption of a file where i am passing the file name as a command line argument,but later on the script waits on the screen to enter Y or N
what is the command i should be using on the shell script
#!/bin/bash -x
outfilename=file.out
echo... (8 Replies)
Discussion started by: rudoraj
8 Replies
3. Shell Programming and Scripting
$$$$$ (5 Replies)
Discussion started by: asirohi
5 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a very small requirement where i need to pass command output as an argument while invoking the shell script..
I need to call like this
sh testscript.sh ' ls -t Appl*and*abc* | head -n 1'
This will list one file name as ana argument..
I will be using "$1" in the shell... (2 Replies)
Discussion started by: pssandeep
2 Replies
5. Shell Programming and Scripting
i want to write a shell script function that will ftp the files passed in the command line . i have written a shell script for ftp but how will it do for all files passed in command line argument ,
i am passing 4 files as argument
./ftp.sh file1 file2 file3 file4
code written by me... (5 Replies)
Discussion started by: rateeshkumar
5 Replies
6. Shell Programming and Scripting
I have one working awk command line. Which taking data from the “J1202523.TXT” file and generating the “brazil.dat” file. PFB code.
awk '{ DUNS = substr($0,0,9);if ( substr($0,14,3) == "089" ) print DUNS }' J1202523.TXT > Brazil.dat
But now I want to pass two parameter as a command line argument... (4 Replies)
Discussion started by: humaemo
4 Replies
7. Programming
Hello all,
New to C and I'm trying to write a program which can run a unix command. Would like to have the option of giving the user the ability to enter arguments e.g for "ls" be able to run "ls -l".
I would appreciate any help.
Thanks
#include <stdio.h>
#include <unistd.h>
#include... (3 Replies)
Discussion started by: effizy
3 Replies
8. Shell Programming and Scripting
Hi,
I have a requirement to work on script, it should take either of arguments.
wrote it as below.
#!/bin/bash
usage() {
echo "$0: missing argument OR invalid option !
Usage : $0 -m|-r|-d
}
while getopts mrdvh opt; do
case "$opt" in
m) monitor_flag=monitor;;... (1 Reply)
Discussion started by: ramanaraoeee
1 Replies
9. Shell Programming and Scripting
I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like
invalid option - - should pass the argument.
and Exit from the script
https://www.unix.com/images/misc/progress.gif (1 Reply)
Discussion started by: Nsharma3006
1 Replies
10. UNIX for Dummies Questions & Answers
I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like
invalid option - - should pass the argument.
and Exit from the script (8 Replies)
Discussion started by: Nsharma3006
8 Replies
LEARN ABOUT DEBIAN
crypt::smbhash
SmbHash(3pm) User Contributed Perl Documentation SmbHash(3pm)
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.10.0 2005-09-24 SmbHash(3pm)