Sponsored Content
Full Discussion: List of Shell Env Vars
Top Forums Shell Programming and Scripting List of Shell Env Vars Post 302768119 by zazzybob on Friday 8th of February 2013 03:40:07 AM
Old 02-08-2013
Something like
Code:
# env | sort -t= -k1 | grep '^[M-S][^=]*='
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
PWD=/root
SHELL=/bin/bash
SHLVL=1

Will work - this will display all environment variables starting with M through to S inclusive.

Cheers,
ZB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding command line env in cron env

Hello friends, i run two scripts manually & they work. i run them in cron & they don work. how to match the two env's 1.command line env 2.cron env i would like cron to use command line env. Thanks & Regards Abhijeet (1 Reply)
Discussion started by: abhijeetkul
1 Replies

2. Shell Programming and Scripting

Env vars in a SED script

Hello, <Preamble> I'm writing an installation script for use with PKGADD. What I want to do is take one of the variables set in the REQUEST script and use that in the install script so I can change applications configuration. My install script is as follows: sed ' /^DIRNAME/ i\... (8 Replies)
Discussion started by: Bags
8 Replies

3. AIX

Is there a way to list all the functions dotted in to the env?

Hi People, Please advise if there is a command to retrieve the list of functions (user-defined) available at any certain point? Cheers (1 Reply)
Discussion started by: easwam
1 Replies

4. Shell Programming and Scripting

check a list of vars

I have about 20 different variables that I need to check for null values then replace with a specific string if they are null. I've been doing this via 20 different if then statements like this: if ; then WIND="UUU" fi Is there a more elegant way to do this? The vars aren't sequential in... (6 Replies)
Discussion started by: audiophile
6 Replies

5. Shell Programming and Scripting

How to run cmds after changing to a new env (shell) in a shell script

Hi, I am using HP-UNIX. I have a requirement as below I have to change env twice like: cadenv <env> cadenv <env> ccm start -d /dbpath ccm tar -xvf *.tar ccm rcv .... mv *.tar BACKUP but after I do the first cadenv <env> , I am unable to execute any of the later commands . ... (6 Replies)
Discussion started by: charlei
6 Replies

6. Shell Programming and Scripting

awk operating with shell vars only

Hi all How do I use awk such that it does not require an input file? I have a situation where I need to process some shell vars within awk (passed into awk with "-v VAR1=$VALUE1, VAR2=$VALUE2" etc), but that processing does not require/use an input file. Any guidance? TIA JG (2 Replies)
Discussion started by: jgrogan
2 Replies

7. Windows & DOS: Issues & Discussions

shell and vImproved for win env

i have pleasure in using shell scripts and vi editor. VI Improved on Linux is also good. Is there a way that allows using shell as command interpretor and VIm as editor to work on windows? (not vi.exe) any help....... (1 Reply)
Discussion started by: paresh n doshi
1 Replies

8. Shell Programming and Scripting

forcing modified env vars to be effective

Hi I have a /bin/sh script, that when executed changes some env vars (like $path). How can I source the modified cshrc? I dont want to logout and login to have the modifed path. sh doesnot recognize source as I understand it is defined only in bash rehash also doesnot work.. Any ideas... (10 Replies)
Discussion started by: jake_ryan
10 Replies

9. Shell Programming and Scripting

Set/Export Env Vars from with Shell Script With Input Variable

I have a shell script I want to run that will set environment variables based on the value of an input variable submitted when the shell script is called. For example: $ mgenv.sh prod This would set environment variables for prod $ mgenv.sh test This would set environment variables... (1 Reply)
Discussion started by: brtaylor73
1 Replies

10. Shell Programming and Scripting

Perl - pass shell-vars into perl for input loop

I need to process a file line-by-line using some value from a shell variable Something like:perl -p -e 's/$shell_srch/$shell_replace/g' input.txt I can't make the '-s' work in the '-p' or '-n' input loop (or couldn't find a syntaxis.) I have searched and found... (4 Replies)
Discussion started by: alex_5161
4 Replies
Env::Sanctify(3pm)					User Contributed Perl Documentation					Env::Sanctify(3pm)

NAME
Env::Sanctify - Lexically scoped sanctification of %ENV VERSION
version 1.06 SYNOPSIS
my $sanctify = Env::Sanctify->sanctify( sanctify => [ '^POE' ] ); # do some stuff, fork some processes etc. $sanctify->restore { my $sanctify = Env::Sanctify->sanctify( env => { POE_TRACE_DEFAULT => 1 } ); # do some stuff, fork some processes etc. } # out of scope, %ENV is back to normal DESCRIPTION
Env::Sanctify is a module that provides lexically scoped manipulation and sanctification of %ENV. You can specify that it alter or add additional environment variables or remove existing ones according to a list of matching regexen. You can then either "restore" the environment back manually or let the object fall out of scope, which automagically restores. Useful for manipulating the environment that forked processes and sub-processes will inherit. CONSTRUCTOR
"sanctify" Creates an Env::Sanctify object. Takes two optional arguments: 'env', a hashref of env vars to add to %ENV; 'sanctify', an arrayref of regex pattern strings to match against current %ENV vars; Any %ENV var that matches a "sanctify" regex is removed from the resultant %ENV. METHODs "restore" Explicitly restore the previous %ENV. This is called automagically when the object is "DESTROY"ed, for instance, when it goes out of scope. AUTHOR
Chris Williams <chris@bingosnet.co.uk> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Chris Williams. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-03-14 Env::Sanctify(3pm)
All times are GMT -4. The time now is 06:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy