Sponsored Content
Full Discussion: "$" in environment variable
Top Forums UNIX for Dummies Questions & Answers "$" in environment variable Post 32189 by lamac on Wednesday 20th of November 2002 08:56:07 AM
Old 11-20-2002
I'm using SunSolaris.

I know, it sounds crazy, it's not my fault. I'm migrating a VAX/VMS (no I'm not 60 years old...) application to UNIX, but I'm not that much aquainted with UNIX. But I do know how to read values from a shell.

The value is set with "setenv", like this:

setenv 'DIR$INP' "$HOME/cart/log"

This works, and I can see the values in the environment. But I can't access the value with $DIR\$INP. I don't get it.
lamac
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Reset environment - ".. /etc/.environment dev_env"

I have been resently working on some ksh script. One of the line in the file writes: .. /etc/.environment dev_env I can not understand what this mean, all I know is .environment is unix system environment file. Is ".." a command? If some one can give me some clue where can I find information... (7 Replies)
Discussion started by: zzwu3591
7 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. Shell Programming and Scripting

What is the "NAME" environment variable used for ?

Hi all, I am running Solaris and I just find there is an environment variable called "NAME" set in my .profile. I googled it for a while and still don't know what is this variable used for (I think it is different as USERNAME or USER?)? When I used mailx to send emails to my PC (thought... (4 Replies)
Discussion started by: qiulang
4 Replies

4. Shell Programming and Scripting

if [ "variable" = "numerical-range" ]; then

been a while so i'm a bit rusty and need a little help. writing a script that needs to compare $EXECHOST(a number) against a numerical range and then set a value. below isn't working but should give you folks an idea of my goal: if ; then echo "This is a 32B machine, exiting..." if ;... (4 Replies)
Discussion started by: crimso
4 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Solaris

Solaris Operating Environment Installation CD, aka "CD0" PN: 704-7076-10

Hi to all. It is need to install Solaris 2.5.1 on Sun Enterprise 220r and 420r. Share somebody Solaris Operating Environment Installation CD, aka "CD0" PN: 704-7076-10 ... It is very necessary! ! ! PM or ftp link.... :D (4 Replies)
Discussion started by: aivengoff
4 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
GETENV(3)						   BSD Library Functions Manual 						 GETENV(3)

NAME
getenv, putenv, setenv, unsetenv -- environment variable functions LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> char * getenv(const char *name); int putenv(char *string); int setenv(const char *name, const char *value, int overwrite); int unsetenv(const char *name); DESCRIPTION
These functions set, unset and fetch environment variables from the host environment list. For compatibility with differing environment con- ventions, the given arguments name and value may be appended and prepended, respectively, with an equal sign ``=''. The getenv() function obtains the current value of the environment variable, name. The setenv() function inserts or resets the environment variable name in the current environment list. If the variable name does not exist in the list, it is inserted with the given value. If the variable does exist, the argument overwrite is tested; if overwrite is zero, the variable is not reset, otherwise it is reset to the given value. The putenv() function takes an argument of the form ``name=value'' and is equivalent to: setenv(name, value, 1); The string pointed to by string becomes part of the environment. A program should not alter or free the string, and should not use stack or other transient string variables as arguments to putenv(). The setenv() function is strongly preferred to putenv(). The unsetenv() function deletes all instances of the variable name pointed to by name from the list. Note that only the variable name (e.g., "NAME") should be given; "NAME=value" will not work. RETURN VALUES
The getenv() function returns the value of the environment variable as a NUL-terminated string. If the variable name is not in the current environment, NULL is returned. The setenv(), putenv(), and unsetenv() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
[EINVAL] The function unsetenv() failed because name was not found in the environment list. [ENOMEM] The function setenv() or putenv() failed because it was unable to allocate memory for the environment. LEGACY SYNOPSIS
#include <stdlib.h> void unsetenv(const char *name); unsetenv() doesn't return a value. COMPATIBILITY
putenv() no longer copies its input buffer. This often appears in crash logs as a crash in getenv(). Avoid passing local buffers or freeing the memory that is passed to putenv(). Use setenv(), which still makes an internal copy of its buffers. unsetenv() no longer parses the variable name; e.g., unsetenv ("FOO=BAR") no longer works. Use unsetenv("FOO"). unsetenv() also now returns a status value and will set errno to EINVAL if name is not a defined environment variable. SEE ALSO
csh(1), sh(1), execve(2), compat(5), environ(7) STANDARDS
The getenv() function conforms to ISO/IEC 9899:1990 (``ISO C90''). BUGS
Successive calls to setenv() or putenv() assigning a differently sized value to the same name will result in a memory leak. The FreeBSD semantics for these functions (namely, that the contents of value are copied and that old values remain accessible indefinitely) make this bug unavoidable. Future versions may eliminate one or both of these semantic guarantees in order to fix the bug. HISTORY
The functions setenv() and unsetenv() appeared in Version 7 AT&T UNIX. The putenv() function appeared in 4.3BSD-Reno. BSD
December 11, 1993 BSD
All times are GMT -4. The time now is 09:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy