Skip to content
Advertisement

Finding linux users with a bash script

i am newbie in bash-scripting and linux. I want to write a script to get a username from the terminal and say whether that username is on the passwd or not. i wrote and tried below script but it doesn’t work. help me that what i can do.

JavaScript

how i can define a variable to read a string from termnial.

Advertisement

Answer

To print and read an argument from terminal, you should use echo and then use read commane and then call it with dollar-sign, finally the script know what you want. for example:

JavaScript

here is the correct form of your code:

JavaScript

Tips:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement