10 More Discussions You Might Find Interesting
1. Solaris
This is for Solaris-11.
We have our customize sudoers to fulfill requirements and that is placed in /usr/local/etc/. Already removed /etc/sudoers, which comes with OS default. But OS it still looking for /etc/sudoers when I give sudo command. How to make him look into /usr/local/etc ?... (7 Replies)
Discussion started by: solaris_1977
7 Replies
2. UNIX for Dummies Questions & Answers
I would like to install a binary from source on a custom path, say /usr/local/myapps. There is no --prefix option in ./configure How can I "make install" at custom path. I tried this.
No --prefix
root@server # ./configure --help | grep prefix
root@server #
Make install
... (3 Replies)
Discussion started by: anil510
3 Replies
3. Shell Programming and Scripting
hi all,
i have to implement a mini-SHELL for a project in C++
i used "system()" to call bash functions found in $PATH
i want to change this variable to $MYPATH, so, when i execute a coommand,
the program will look for it in $MYPATH, not in $PATH
how can i do it? (1 Reply)
Discussion started by: bismillah
1 Replies
4. Shell Programming and Scripting
Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example
start="BEGIN /home/mavkoup/data"
end="END"
sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Discussion started by: mavkoup
4 Replies
5. Shell Programming and Scripting
Hello Folks,
I want to append a path in user's PATH variable which should be available in current session.
Background
Numerous persons will run a utility.
Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies
6. Shell Programming and Scripting
Hi All,
In make file i want to include header files from my local directory and if it did not find in local directory i want to include from network directory. can any help me how i can do this?.
here is the code
INCLUDE=${include}/
this is point to network dir how i can add option that it... (1 Reply)
Discussion started by: goraya430
1 Replies
7. Shell Programming and Scripting
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
Discussion started by: royalibrahim
2 Replies
8. Shell Programming and Scripting
Hi
I need a script which will remove a path from PATH environment variable. For example
$echo PATH
/usr/local/bin:/usr/bin:test/rmve:/usr/games
$echo rmv
test/rmve
Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
Discussion started by: madhu84
9 Replies
9. Shell Programming and Scripting
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)
Discussion started by: alrinno
2 Replies
10. Programming
In the funtion C function link(char *existing, char *new);
existing has to be an absolute path.
But what happens if i want to make a ling to a file in the users home directory (assume file.txt exists)
i cant put in a "~/file.txt" or "./file.txt"
How can i turn the above into the entire path... (1 Reply)
Discussion started by: youngvet
1 Replies
Env(3) User Contributed Perl Documentation Env(3)
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.16.3 2013-03-02 Env(3)