You should start by looking at the values contained in the %ENV function.
The following (once inserted into a perl script and run) will display the environment variables in the %ENV hash.
$ENV{"USER_NAME"} and $ENV{"HOME"} will be a place to start.
For the date, you should look over the localtime function in perl.
Search the perl/unix/whatever forums here for perl localtime and you will find a wealth of information.
hi,
I am new to Unix and script writing so I was wondering if this would be possible and how I might do it. I've learned to write a basic script and the first step I need to do is to open a program (for genetic linkage). The program then requires me to enter a lot of information. Sort of line... (1 Reply)
Hi,
I am wondering if there is a way to find out in a C software program if a particular process is running without having to write a file. In the past, I have been using the system command to execute a pgrep and output the info to a file. Then the C program reads the file to make the... (1 Reply)
Hello,
I'm running a perl script to execute a program through my Unix command line. The program requires a user input but I want to automatically have perl input the string. Is there a way to do this?
Thanks (1 Reply)
Hi I need help..........
I have an Sun One Directory server LDIF file with 5000 user entries, I need to change the data to match Test ID's, so I can run a perf test.
I'm way out of my league as I have not done any scripting for 10 years.
There are four entries for each user in the file... (3 Replies)
Hi all,
How to:
Run a bash script, display on the screen and save all information in a file including error information.
For example:
I have a bash script called test.sh
now I want to run the test.sh and display the output on the screen and save the output including error info to a file.
... (1 Reply)
Hello all,
I want to display all the user logged last week and know the time tnat they are connected. I have been looking for a solution in the Forum, but I didn't find.
Thanks in advance (4 Replies)
I have written the following bash function prArgv
Suppose the calling sequence is as follows
prArgv VAL1 VAL2 DESC VAL3 VAL4 v2d1 s4 p15
The call will look at the tag k1v2, add the numbers together, in this case 2+1=3
This means that the function will look at the first 3 user arguments... (1 Reply)
Hello all..
so i have a problem i need to solve ..
#! /bin/bash
$SHELL
dtterm -title my_prog -e su -user -c 'export DISPLAY=:0.0 ; /path/to/my/prog' & 2> /dev/null
$SHELL
intr
exit
This script will work on solaris 10 system in right clikt menu - in a secure system so i need to... (0 Replies)
Discussion started by: defs
0 Replies
LEARN ABOUT SUSE
env
Env(3pm) Perl Programmers Reference Guide Env(3pm)NAME
Env - perl module that imports environment variables as scalars or arrays
SYNOPSIS
use Env;
use Env qw(PATH HOME TERM);
use Env qw($SHELL @LD_LIBRARY_PATH);
DESCRIPTION
Perl maintains environment variables in a special hash named %ENV. For when this access method is inconvenient, the Perl module "Env"
allows environment variables to be treated as scalar or array variables.
The "Env::import()" function ties environment variables with suitable names to global Perl variables with the same names. By default it
ties all existing environment variables ("keys %ENV") to scalars. If the "import" function receives arguments, it takes them to be a list
of variables to tie; it's okay if they don't yet exist. The scalar type prefix '$' is inferred for any element of this list not prefixed by
'$' or '@'. Arrays are implemented in terms of "split" and "join", using $Config::Config{path_sep} as the delimiter.
After an environment variable is tied, merely use it like a normal variable. You may access its value
@path = split(/:/, $PATH);
print join("
", @LD_LIBRARY_PATH), "
";
or modify it
$PATH .= ":.";
push @LD_LIBRARY_PATH, $dir;
however you'd like. Bear in mind, however, that each access to a tied array variable requires splitting the environment variable's string
anew.
The code:
use Env qw(@PATH);
push @PATH, '.';
is equivalent to:
use Env qw(PATH);
$PATH .= ":.";
except that if $ENV{PATH} started out empty, the second approach leaves it with the (odd) value "":."", but the first approach leaves it
with ""."".
To remove a tied environment variable from the environment, assign it the undefined value
undef $PATH;
undef @LD_LIBRARY_PATH;
LIMITATIONS
On VMS systems, arrays tied to environment variables are read-only. Attempting to change anything will cause a warning.
AUTHOR
Chip Salzenberg <chip@fin.uucp> and Gregor N. Purdy <gregor@focusresearch.com>
perl v5.12.1 2010-04-26 Env(3pm)