List of Shell Env Vars


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting List of Shell Env Vars
# 1  
Old 02-08-2013
List of Shell Env Vars

Hia,

Code:
echo ${!S*}

gives me all those env vars starting with S like SHELL SECONDS SHELLOPTS SHLVL etc.

is there any way to deflate the shell variables' range like

Code:
echo ${!A-E*}

OR
Code:
echo ${!A..S*}

to list all env vars starting within range of A till E. Thanks

Regards,
Nasir
# 2  
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question