How will you assign the value of variable var2 to var1? - ProProfs Discuss
Advertisement

How will you assign the value of variable var2 to var1?

How will you assign the value of variable var2 to var1?<br/>

Change Image    Delete

Asked by Nbans, Last updated: Nov 09, 2024

+ Answer
Request
Question menu
Vote up Vote down

2 Answers

G. Woods

G. Woods

Traveler and writer by profession.

G. Woods
G. Woods, College student, Graduate, Southampton

Answered Sep 24, 2020

You will assign the value of variable var2 to var 1 in this mode; Var1=$var2
A variable is defined by merely assigning a value to a name making use of the = operator. A variable name is a set of alphanumeric character beginning with an alphabet or -. Variables are totally regarded as alphabetical strings, except the context needs them to be regarded as a numeric value. A variable is nothing more than an indicator of the main data.

The shell helps you to build, give, and remove variables. $ character signifies the process ID figure, or PID, of the present shell. You can as well define new variables inside your shell script program.

Variables to the shell are designed to make use of an easy assignment without spaces. However, the shell isn't bothered about the kinds of the variable; they may keep integers, strings, and real numbers.

upvote downvote
Reply 

nbans

nbans

nbans
Nbans

Answered Nov 17, 2017

Var1=$var2
upvote downvote
Reply