Linux shell variable help

Hello,

This is probably a real no brainer for someone with experience in shell scripts but,

I am new to Linux and scripting and was wondering if someone can explain to me what the following statements do?

Specifically what is .$$
$TMP.1

If you could take it line by line that would be extremely helpful.


TMP=/tmp/new_issue.$$
TFILE1=$TMP.1
TFILE2=$TMP.2
echo "RZ_ISSUE_NAME     $*" > $TMP
echo "RZ_ISSUE_VER      $*" >> $TMP
cat $* >> $TMP
rz_issue_summarize_file $TMP > $TFILE1

thanks in advance,

Don

dprice7Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

scampgbCommented:
Hi dprice7,

I can't say that I'm an expert shell-scripter, but I'll offer the help I can :-)

> Specifically what is .$$

$$ is the PID (process ID) of the process that's running.  Example:
echo $$
...will give you the PID of the shell that you executed the echo command from.  Does that make sense?

$* means the parameters that were put on the command-line of the script

In your example below, I'll assume that your PID is 13900  and that the command-parameter was "BANANA"
'scuse the formatting :-)


TMP=/tmp/new_issue.$$                                                               --- variable TMP now equals /tmp/new_issue.13900
TFILE1=$TMP.1                                                                               -- variable TFILE1 now equals /tmp/new_issue.13900.1
TFILE2=$TMP.2                                                                                -- variable TFILE1 now equals /tmp/new_issue.13900.1
echo "RZ_ISSUE_NAME     $*" > $TMP                                      -- append "RZ_ISSUE_NAME      BANANA" to  /tmp/new_issue.13900
echo "RZ_ISSUE_VER      $*" >> $TMP                                     -- append "RZ_ISSUE_VER      BANANA" to  /tmp/new_issue.13900
cat $* >> $TMP                                                                                  -- append "BANANA" to  /tmp/new_issue.13900
rz_issue_summarize_file $TMP > $TFILE1                              --- I don't know what rz_issue_summarize_file does, so can't comment on this

Does that help to explain it?


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dprice7Author Commented:
Hi scampgb,

thanks much!

Don
0
scampgbCommented:
Glad I could help.  Good luck with the scripting :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.