run time parameter in usermod (381 Views)
Reply
Occasional Advisor
madhuthelearner
Posts: 12
Registered: ‎03-04-2013
Message 1 of 6 (381 Views)

run time parameter in usermod

Hi

 

Is it possible to send run time paramater to below command

 ?

 

/usr/sbin/usermod -p $(perl -e"print crypt('ABcd1234','xxxxxxxx')") -F $Zuser

 

 

i have to pass run time parameter to ABcd1234

Acclaimed Contributor
Dennis Handly
Posts: 25,287
Registered: ‎03-06-2006
Message 2 of 6 (371 Views)

Re: run time parameter in usermod

[ Edited ]

>Is it possible to send run time parameter to below command

 

You mean pass a shell variable to perl?  In place of ABcd1234?

Occasional Advisor
madhuthelearner
Posts: 12
Registered: ‎03-04-2013
Message 3 of 6 (368 Views)

Re: run time parameter in usermod

Hi Dennis,

 

 

You mean pass a shell variable to perl?  In place of ABcd1234?

 

yes.

 

 

in usermod command ,for username I have passwd Zuser,in the same way I have to pass for password.

 

 

 

 

Acclaimed Contributor
Dennis Handly
Posts: 25,287
Registered: ‎03-06-2006
Message 4 of 6 (363 Views)

Re: run time parameter in usermod

Well you can use obvious stuttering quotes:

/usr/sbin/usermod -p $(perl -e"print crypt('"$password"','xxxxxxxx')") -F $Zuser

 

Or you look up an exported variable in the environment.

Or pass it as an argument after the -e string.

Occasional Advisor
madhuthelearner
Posts: 12
Registered: ‎03-04-2013
Message 5 of 6 (358 Views)

Re: run time parameter in usermod

Hi Dennis,

 

Can you give me an example.

Acclaimed Contributor
Dennis Handly
Posts: 25,287
Registered: ‎03-06-2006
Message 6 of 6 (353 Views)

Re: run time parameter in usermod

>Can you give me an example.

 

Of which?  I showed you how to use a shell variable directly.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.