1828236 Members
2598 Online
109975 Solutions
New Discussion

About the script

 
SOLVED
Go to solution
juno2
Super Advisor

About the script

I am new comer to write a UNIX shell script, I have a simple question ,

I can run the command
# w -u
the result is normal, but why I can't set it as a variable in my script program :
# login = `w -u`
Password:

3 REPLIES 3
James Murtagh
Honored Contributor
Solution

Re: About the script

Hi,

First of all, you shouldn't use variable names such as "login", which in itself is a command. Next there is no space between the "=" sign. A more readable form would be:

logins=$(w -u)

Also, people may stop helping you if you continue to avoid assigning points. 0 from 100 posts is not good.

Cheers,

James.
RAC_1
Honored Contributor

Re: About the script

login is command, that is why it is prompting for password.

say

juno=`w -u`

now echo $juno
There is no substitute to HARDWORK
T G Manikandan
Honored Contributor

Re: About the script

the syntax is like

variable = value

login is a command you can use it.

Just use any variable.

x=`w -u`