I have a problem with retreiving the value of an environment variable. The name of the variable is:
DIR$INP
I am not able to change the name of the variable, because it is used by programs to which I do not have access to. The variable contains the name of a directory as value. I have tried many things to access this value on a shell, but I haven't succeeded. I've tried things like:
echo $DIR$INP
echo $DIR\$INP
echo ${DIR\$INP}
echo $'DIR\$INP'
echo $"DIR\$INP"
Nothing seems to work. Can anybody help me please... Thank you,
I have a problem with retreiving the value of an environment variable. The name of the variable is:
DIR$INP
What shell are you using that allows a '$' in a variable name? How does it get set? This looks like a VMS-ism to me --- are you running some program cross platform?
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.
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.
Okay, you're using csh or tcsh: Both will allow you to set such a variable, but neither will allow you to use it in the shell. If you need the value of this variable at the shell level do something like one of these:
At least one of these should work.
Originally posted by lamac
thanks, the second one works. But what does it do? If it's not too much trouble, couöd you just briefly explain??
Okay, assuming you mean this one:
"env" just echoes the entire environment to standard output.
"|" strings the standard output of one command to the standard input of the next; this is called a "pipe" or (as a transitive verb) "piping".
grep (global regular expression print) selects lines from its input according to a specification. Putting the specification in apostrophes prevents expansion of shell variables. Consult the man page for more --- much more!
The result of grep is the piped into "cut". "-d=" tells cut to separate fields by the equal sign, and "-f2" tells it to print the second field.
This solution should probably be changed to
to prevent the grep from matching on DIR$INPUT_SEQUENCE, DIR$INPUT_METHOD, etc.
NB: I'm surprised that the awk in Solaris doesn't take the first solution ... maybe change "awk" to "nawk"? Consult the man pages to find out why.
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)
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)
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)
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)
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)
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)
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)
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)
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)