logo
down
shadow

Why can't the Opsview_rest Perl script not find the OPSVIEW_URL_PREFIX Environment variable using $ENV{var} while it has


Why can't the Opsview_rest Perl script not find the OPSVIEW_URL_PREFIX Environment variable using $ENV{var} while it has

By : user2950832
Date : November 17 2020, 11:58 AM
This might help you A good way to debug problems like this is to strip them to to the simplest possible thing that demonstrates the problem.
Here is a perl "one-liner" that shows that @hobbs is correct, that sudo is stripping the password.
code :
$ TESTY=foo sudo perl -le 'print "The value is $ENV{TESTY}..."'
The value is ...
$ TESTY=foo perl -le 'print "The value is $ENV{TESTY}..."'
The value is foo...
$ TESTY=foo sudo -E perl -le 'print "The value is $ENV{TESTY}..."'
The value is foo...


Share : facebook icon twitter icon
Can we set a variable used in a Perl script as environment variable?

Can we set a variable used in a Perl script as environment variable?


By : CharLee
Date : March 29 2020, 07:55 AM
This might help you If you want to affect the environment of your process or your child processes, just use the %ENV hash:
code :
$ENV{CVSROOT}='<cvs>';
#!/usr/bin/perl -w
print 'export CVSROOT=<cvs>';
eval `myscript.pl`
using environment variable in the perl script

using environment variable in the perl script


By : user2477166
Date : March 29 2020, 07:55 AM
it should still fix some issue $GATE in a double quoted string will be considered a Perl variable. If you want to use an environment variable, you can use the %ENV hash:
code :
system ("bsub xyz +OPTIONS_GATE=$ENV{GATE}")
system ("bsub xyz +OPTIONS_GATE=\$GATE")
system ('bsub xyz +OPTIONS_GATE=$GATE')
use strict;
use warnings;
Global symbol "$GATE" requires explicit package name
Execution of script.pl aborted due to compilation errors.
Name "main::GATE" used only once: possible typo at script.pl line 12.
Use of uninitialized value $GATE in string at script.pl line 12.
Getting in a perl program environment variable set by a shell script

Getting in a perl program environment variable set by a shell script


By : abam0573
Date : March 29 2020, 07:55 AM
This might help you I own a perl subroutine which some other module calls. There is a shell script setjavaenv.sh and a batch script setjavaenv.bat which sets the environment variable JAVA_HOME. Now I need to invoke a java program from my subroutine using the JAVA_HOME set by setjavaenv.sh. Is there a way to do this without writing a new shell/bat script(which perhaps prints the value)?
Setting an environment variable through a Perl script

Setting an environment variable through a Perl script


By : Kulu Uthappa
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Your current script doesn't even change an environment variable in the Perl script itself. Rather, it invokes a shell as a subprocess; that shell process executes . /root/.profile, which updates $LD_LIBRARY_PATH only in that shell process.
You can change an environment variable in a Perl script (more precisely, in the process running the Perl script) by updating %ENV:
Can't access shell variable in perl script unless it's an environment variable

Can't access shell variable in perl script unless it's an environment variable


By : Mike L.
Date : March 29 2020, 07:55 AM
may help you . You are not getting the value of AAA variable because AAA is local env variable where as BBB is exported variable.
Exported variables are carried into the environment of processes started by the shell that exported them, while non-exported variables are local to the current process only.
code :
$ set AAA=123
$ csh
$ echo $AAA
AAA: Undefined variable.
$ exit

$ setenv BBB 456
$ csh
$ echo $BBB
456
Related Posts Related Posts :
  • Linux, Backtrack, Perl, Bluesniff
  • perl cgi print header charset not work
  • Any way to set keepalive in DBI connect method in Perl
  • Perl script does not recognize paths which contains environment variables
  • How to stop Runaway Perl Process
  • Scoping variables in a Perl Test::More .t file
  • Perl Sort Array
  • Content-Type setting for .MTS files
  • Seek function not working in perl
  • Perl syntax error printing list index
  • perl matching syntax with mail filter
  • Error Handling Using Perl Tkx
  • Perl : calculation of time in format hh:mm:ss,sss
  • Remove element from array containing empty or whitespace character in Perl
  • Running an external command in Perl / Tkx without blocking the GUI (Windows)
  • Passing multiple values to a Perl program in a single command line argument
  • perl Parallel::ForkManager stuck in this script?
  • Unable to escape @ sign in perl
  • Loop to define buttons in Perl / Tkx
  • Get http-response header with Perl's File::Fetch
  • Perl Get the web content then writing it as a text file
  • perl $CGI::POST_MAX all parameters
  • Perl Foreach until loop
  • login failed to remote host - prompt does not match at /usr/lib/perl5/site_perl/5.10.0/Net/Appliance/Session/Transport.p
  • How is a literal list having one element represented unambiguously in perl?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org