Shell Script Passing Parameters For Directory Listing
i have this basic piece of code that i am trying to debug to accept input parameter to be able to display a directory listing of files.
basically if the script does not see any parameter being passed it will display all the file listing of the current directory. and if it find a parameter it display only a specfic files on the directory. the above code does not work and when i run i am getting this error:
Hi ,
I want to pass parameters from a shell script to a sql script and use the parameter in the sql query ..and then I want to spool a particular select query on to my unix box... for 4 different locations by writing only one sql script
Right now no file is generated on the unix box...it is a... (2 Replies)
I am having a shell script which has to be called from a C program. I have to pass two parameters to this script. HOw can I do that?
eg:
int main()
{
char st1;
char str2;
// call a shell script
call_sh(str1,str2) where call_sh is the name of the shell script.
then i need to get the return... (5 Replies)
Hi All,
Does anyone have any solutions for passing back multiple variables back to the SHELL from a call to an ORACLE procedure:
eg
#username='scott'
#password='tiger'
#database='orcl'
username='ITGCD03D03'
password='tC5epIew'
database='ITGCD03D'
sqlplus -s... (4 Replies)
I am using grep to capture date from a file .
Since i need to use the shell script for different dates ,is it possible to pass the date parameter to the shell script
the Script is as below
grep -E "08 Aug 2008|2008-08-08"* somefile.txt>test.txt
The above script file greps the... (1 Reply)
Hi there
I'm new to UNIX scripting; I’m stuck with the following
I have an Oracle SQL script that takes three parameters
1- File Name
2- File Path
3- File creation date
Under UNIX I have a folder where files will be placed frequently and I need to upload those files to Oracle, what I need... (3 Replies)
Hello,
I have this shell script that runs awk code by passing in parameters however now it doesn't work anymore with the parameters and I don't know why.
It removes duplicates from an input file based on a part of the last field and a key column. It removes the record with the older datetime... (0 Replies)
I am trying to execute a copy command via shell script. However, on occassion, 2 or more files need to copied. How do I code for the multiple arguments? Does it matter how the files are delimited?
Example: I have a script to copy files from 1 dir to another called duplicate.csh
In most... (1 Reply)
how can i make a script to run only when parameters are given,
if parameters are not given it should through an error , saying "please enter a parameter"
for ex: i want a find command to run only when the parameters are given (4 Replies)
Hello All,
I am interested in finding out a way to pass parameters that are entered at the prompt from HP unix and passed to SQLPlus code with a Shell Script. Is this possible?
Thanks (4 Replies)
Hi,
I have a query regarding execution of a sql query having long listing of parameters ..I need to execute this query inside a shell script.
The scenario is like....
Suppose I have a file abc.txt that has the card numbers..it could be in thousands..
then I need to fire a query like
... (12 Replies)
Discussion started by: vsachan
12 Replies
LEARN ABOUT SUSE
file::listing
File::Listing(3) User Contributed Perl Documentation File::Listing(3)NAME
File::Listing - parse directory listing
SYNOPSIS
use File::Listing qw(parse_dir);
$ENV{LANG} = "C"; # dates in non-English locales not supported
for (parse_dir(`ls -l`)) {
($name, $type, $size, $mtime, $mode) = @$_;
next if $type ne 'f'; # plain file
#...
}
# directory listing can also be read from a file
open(LISTING, "zcat ls-lR.gz|");
$dir = parse_dir(*LISTING, '+0000');
DESCRIPTION
This module exports a single function called parse_dir(), which can be used to parse directory listings.
The first parameter to parse_dir() is the directory listing to parse. It can be a scalar, a reference to an array of directory lines or a
glob representing a filehandle to read the directory listing from.
The second parameter is the time zone to use when parsing time stamps in the listing. If this value is undefined, then the local time zone
is assumed.
The third parameter is the type of listing to assume. Currently supported formats are 'unix', 'apache' and 'dosftp'. The default value
'unix'. Ideally, the listing type should be determined automatically.
The fourth parameter specifies how unparseable lines should be treated. Values can be 'ignore', 'warn' or a code reference. Warn means
that the perl warn() function will be called. If a code reference is passed, then this routine will be called and the return value from it
will be incorporated in the listing. The default is 'ignore'.
Only the first parameter is mandatory.
The return value from parse_dir() is a list of directory entries. In a scalar context the return value is a reference to the list. The
directory entries are represented by an array consisting of [ $filename, $filetype, $filesize, $filetime, $filemode ]. The $filetype value
is one of the letters 'f', 'd', 'l' or '?'. The $filetime value is the seconds since Jan 1, 1970. The $filemode is a bitmask like the
mode returned by stat().
CREDITS
Based on lsparse.pl (from Lee McLoughlin's ftp mirror package) and Net::FTP's parse_dir (Graham Barr).
perl v5.12.1 2008-09-24 File::Listing(3)