Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

run time parameter in usermod

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.

Highlighted
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.