How do you see this? Do you see it as the letters abc plus the $ character and the numbers 123?
The shell see it as the string "abc', the positional variable deference $1 and the string "23"
Since there's nothing in $1 it assigns to par2 the string "abc23"
The shell sees the string "abc" and the variable deference $xyz. And it appears that $xyz produces an empty string.
This is what Don said. Let us take apart the right side of the equation:
Therefore you get "abc23" with a "nothing" in between "abc" and "23".
Quote:
Originally Posted by ken6503
when trying
I got
Yes, because the difference is: "$xyz" is a legal variable name while "$123" is not. The variable "$xyz" might not be defined and therefore hold no content (which seems to be the case, because it evaluates to nothing), but it is still a legal variables name. "$123" is NOT a legal name, therefore the shell doesn't even try to evaluate it. Instead it uses what could be a legal name ("$1") and treats everything following it as a literal string again.
You could generate the same effect in your second example by surrounding the variables name with curly braces:
The same mechanism: "abc" is a literal string, the "$x" (which is empty, so ""), then "yz", which is again a literal string. If "x" is not empty:
Hi Folks,
I have the below command that will kill all the process of an environment,
lets say if I have reached to the location cont directory under which I want to kill multiple process so the command will be ....
kill -9 `ps -ef | grep cont | grep -v grep | awk '{print $2}'`
Now please... (4 Replies)
Hello,
First post for Newbie as I am stumped. I need to get certain elements for a specific PID from the ps command. I am attempting to pass the value for the PID I want to retrieve the information for as a variable. When the following is run without using a variable, setting a specific PID,... (3 Replies)
Hello,
I have a csh script that creates an environment variable. I want to pass the environment variable(CURR_TABLE_DATE) to an Informix sql script. Here is the csh:
#!/bin/csh -f
setenv INFORMIXSERVER market3_tcp
setenv CURR_TABLE_DATE 20090714
set DATABASE = gm_cdr
set SQL_DIR =... (0 Replies)
I need to save my enviroment variables,specially the $PATH.When I put it on .cshrc at next reboot I lost the configuration.How can avoid this?Thanks (2 Replies)
What are the environment setting during a cron session?
I have HP-UX and I want to send the output/file from a script to several e-mail addresses. I want to create an env-var to store the e-mail addresses in my .profile, but I do not know if it will be visible when a script is executed in a cron. (4 Replies)
Im looking for any sample scripts that would output a current environment setup to a file and possibly then take 2 files and list any differences
This will allow us to quickly see any differences between environments in case of issue?
At a high level this would take Unix Kernel Params,... (2 Replies)
Hello...
I was wondering can anyone explain me how to set up enviroment variable to be permanent...
I tryed with setenv but my solaris does not have this command...
then I did:
export ORACLE_SID=base1
export ORACLE_BASE=/home
export ORACLE_HOME=$ORACLE_BASE/oracle/8.1.6
and by... (5 Replies)
Hi guys,
thanks in advance for this easy answer.... :s
Ok I am trying to output the enviroment varable for host in Solaris. I have tried $HOST, $HOST_NAME, $HOSTNAME carn't find it anywhere, does someone want to put me out of my misary and tell me what it is??? :confused: :eek:
Thanks... (2 Replies)
Hi.
Is it possible to remotely access another unix box via an enviroment variable, on another machine?
I am trying to create an environment variable $MIPSDATA which will point to a folder on another machine.
I have setup the .rhosts file and got that working on both machines (tested via a... (4 Replies)
:confused: Hi, does anyone here know how to compile and run C++ in UNIX environment? I am so desperate! Any help is greatly appreciated. Thanks! (3 Replies)