parsing - Adding users from CSV in Linux using BASH -


My CSV file contains the necessary information like this first name, last name, user-side. I have 5 users who will have to parse me with CSV I have hit a wall to create an account assigned to a group (Group 1) and assign an encrypted temporary password, any help would be awesome Thank you!

#! / Bin / bash OLDIFS = $ IFS IFS = "," when first read lastname userid useradd -c "$ firstname $ lastname -d / home / $ userid -G group 1 -s / bin / bash $ userid" done IFS = $ OLDIFS

Adding any user to script execution.

It should help you.

  #! / Bin / bash OLDIFS = $ IFS IFS = "," The first name is read lastname userid Useradd -c "$ {first name} $ {lastname}" -d / home / "$ {userid}" -G group 1 -s / bin / bash "$ {userid}" & lt; File.csv  

Your script is okay, I've made some changes as below

  1. The variable is cited, it will prevent the unwanted extension. It is not necessary to reset
  2. IFS because the script runs in a subseal.
  3. While requires a file input, it has been added.

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -