08-30-2009
Hi.
I updated my post with a link that might help. As SH doesn't support arrays, you need to work around it, and eval is a good solution.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have been trying to create a script that changes the user rights to read in the 'other' group across directories. The problem I'm having is that when i execute the script, the permissions of the directories remains the same.
HELP (8 Replies)
Discussion started by: BigTool4u2
8 Replies
2. AIX
Please help me
1. Please give me the few examples of shell scripts written for AIX
2.I have scripts written on Unix, does that work for AIX, if not what are the changes to be carried out to run the scripts on AIX....
Please help me (4 Replies)
Discussion started by: me_haroon
4 Replies
3. Shell Programming and Scripting
I have a program (say, MyProgram) written in Bourne-shell script, but at some point it calls another script written in pearl, as illustrated below:
#!/bin/sh
.....
case $x in
1) ConfigSystem1 ( b-shell script)
2) ConfigSystem2 ( pl)
3) ConfigSystem3 (b-shell)
....
Then I create... (0 Replies)
Discussion started by: bluemoon1
0 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I am writing somescripts to shut down some services in Korn Shell. Some of the services are under different owners. For example when I want to shutdown NXserver I need to be "root", but when I shut down the webserver I need to be under a different user.
Manual I would use "su root" and... (1 Reply)
Discussion started by: bonekrusher
1 Replies
5. UNIX for Dummies Questions & Answers
This is a newbie question in which I feel almost ashamed in asking lol. I am told to make changes to /etc/rc2.d so that only certain scripts run. If I change something like S05netconfig to s05netconfig will it still run? What is the difference between S and s scripts (I see both types in there).... (1 Reply)
Discussion started by: rkruck
1 Replies
6. Fedora
Hello. I am currently in a class dealing with shell scripts. I know some commands and get the basics of command line in Fedora 11. But the coding....I'm a bit lost. I was very ill for 2 weeks and missed a lot, much of which there are no notes provided.
I'm not asking you to do my homework,... (1 Reply)
Discussion started by: Feuyaer
1 Replies
7. UNIX for Dummies Questions & Answers
I would like to ask if cron when running a planned script changes the current folder for the script.
Thank you! (2 Replies)
Discussion started by: MartyIX
2 Replies
8. AIX
HI i need help from seniors on this issue, i need to know how to do this, i need to update 50+ server starting saturday. below is the ticket which i have with full description.
Currently MQ Series must be stopped before and started after any reboot. Not having the start/stop as part of... (2 Replies)
Discussion started by: gulamibrahim
2 Replies
9. Shell Programming and Scripting
Dear Members,
I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc.
I would like to create a script which will will call other scripts based on the request action.
Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies
LEARN ABOUT OSX
universal::require
UNIVERSAL::require(3) User Contributed Perl Documentation UNIVERSAL::require(3)
NAME
UNIVERSAL::require - require() modules from a variable
SYNOPSIS
# This only needs to be said once in your program.
require UNIVERSAL::require;
# Same as "require Some::Module"
my $module = 'Some::Module';
$module->require or die $@;
# Same as "use Some::Module"
BEGIN { $module->use or die $@ }
DESCRIPTION
If you've ever had to do this...
eval "require $module";
to get around the bareword caveats on require(), this module is for you. It creates a universal require() class method that will work with
every Perl module and its secure. So instead of doing some arcane eval() work, you can do this:
$module->require;
It doesn't save you much typing, but it'll make alot more sense to someone who's not a ninth level Perl acolyte.
Methods
require
my $return_val = $module->require or die $@;
my $return_val = $module->require($version) or die $@;
This works exactly like Perl's require, except without the bareword restriction, and it doesn't die. Since require() is placed in the
UNIVERSAL namespace, it will work on any module. You just have to use UNIVERSAL::require somewhere in your code.
Should the module require fail, or not be a high enough $version, it will simply return false and not die. The error will be in $@ as well
as $UNIVERSAL::require::ERROR.
$module->require or die $@;
use
my $require_return = $module->use or die $@;
my $require_return = $module->use(@imports) or die $@;
Like "UNIVERSAL::require", this allows you to "use" a $module without having to eval to work around the bareword requirement. It returns
the same as require.
Should either the require or the import fail it will return false. The error will be in $@.
If possible, call this inside a BEGIN block to emulate a normal "use" as closely as possible.
BEGIN { $module->use }
SECURITY NOTES
UNIVERSAL::require makes use of "eval STRING". In previous versions of UNIVERSAL::require it was discovered that one could craft a class
name which would result in code being executed. This hole has been closed. The only variables now exposed to "eval STRING" are the
caller's package, filename and line which are not tainted.
UNIVERSAL::require is taint clean.
COPYRIGHT
Copyright 2001, 2005 by Michael G Schwern <schwern@pobox.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
AUTHOR
Michael G Schwern <schwern@pobox.com>
SEE ALSO
Module::Load, "require" in perlfunc, <http://dev.perl.org/rfc/253.pod>
perl v5.16.2 2009-03-30 UNIVERSAL::require(3)