Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

run time parameter in usermod

Highlighted
madhuthelearner
Occasional Advisor

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

5 REPLIES
Dennis Handly
Acclaimed Contributor

Re: run time parameter in usermod

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

 

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

madhuthelearner
Occasional Advisor

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.

 

 

 

 

Dennis Handly
Acclaimed Contributor

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.

madhuthelearner
Occasional Advisor

Re: run time parameter in usermod

Hi Dennis,

 

Can you give me an example.

Dennis Handly
Acclaimed Contributor

Re: run time parameter in usermod

>Can you give me an example.

 

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