Re: run time parameter in usermod (190 Views)
Reply
Occasional Advisor
madhuthelearner
Posts: 12
Registered: ‎03-04-2013
Message 1 of 6 (218 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

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,750
Registered: ‎03-06-2006
Message 2 of 6 (208 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?

Please use plain text.
Occasional Advisor
madhuthelearner
Posts: 12
Registered: ‎03-04-2013
Message 3 of 6 (205 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.

 

 

 

 

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,750
Registered: ‎03-06-2006
Message 4 of 6 (200 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.

Please use plain text.
Occasional Advisor
madhuthelearner
Posts: 12
Registered: ‎03-04-2013
Message 5 of 6 (195 Views)

Re: run time parameter in usermod

Hi Dennis,

 

Can you give me an example.

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,750
Registered: ‎03-06-2006
Message 6 of 6 (190 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.

Please use plain text.
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