Jump to content

shell script problem


rizzler

Recommended Posts

Hello. I am trying to make this shell script bellow work on my server wich should take the names in newacc.cvs and add them to the system. For each user the script should ask me to enter a password for the user im adding and then add them to the system, however my current solution do not work atm as when i run the script it dont stop to let me enter a password at all at the passwd echo, it just runs past it :/ do someone know how to make this work? using READ read -p "Enter your password" PASS

echo $PASS" and the same thing happens :(

 

Example from newacc.cvs

 

maria;jones

andreas;öring

 

Script

 

#!/bin/sh

if [ "$#" == "0" ]
then

cat newacc.cvs | while IFS=';'  read firstname surname;
do

    useradd $firstname -m
    echo  added $firstname to the system
    passwd $firstname
    cd /home/$firstname/
    maildirmake.courier Maildir
    echo Maildir Created for $firstname


done
  exit 0

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.