Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

n00b shell script

Name: Anonymous 2011-02-24 15:06

/prog/, need help. im currently building a script that read list of strings and create new user with their own password that comes from the UPPERCASE string of respective username. why i cant assign password properly?


#!/bin/bash

#download source file
echo "Enter the url of the source file"
read URL
wget $URL

echo
echo "Finished download"
echo

#remove present similar file
for FILE in *
do
    if [ $FILE = St*.* ]; then
    rm $FILE
    fi
done

#print current directory contents
echo "Contents of `pwd` currently : "
ls

echo;echo;echo
for FILE in *
do
    if [ $FILE = St* ]; then
    while read line
    do
    sudo useradd -m $line
    password=$(echo "$line" | tr [:lower:] [:upper:])
    sudo useradd -p $password $line
    echo "Username is $line. Password is $password"
    echo "************************************************************"

    done<St*
    fi
done

----------------------------------------------------------------

the list file looks like this

bill
mark
steve

----------------------------------------------------------------

Name: Anonymous 2011-02-24 15:15

/prog/, need help. im currently building a script that read list of strings and create new user with their own password that comes from the UPPERCASE string of respective username. why i cant assign password properly?



#!/bin/bash

#download source file
echo "Enter the url of the source file"
read URL
wget $URL

echo
echo "Finished download"
echo

#remove present similar file
for FILE in *
do
    if [ $FILE = St*.* ]; then
    rm $FILE
    fi
done

#print current directory contents
echo "Contents of `pwd` currently : "
ls

echo;echo;echo
for FILE in *
do
    if [ $FILE = St* ]; then
    while read line
    do
    sudo useradd -m $line
    password=$(echo "$line" | tr [:lower:] [:upper:])
    sudo useradd -p $password $line
    echo "Username is $line. Password is $password"
    echo "************************************************************"

    done<St*
    fi
done


----------------------------------------------------------------

the list file looks like this. i named them string


bill
mark
steve

----------------------------------------------------------------

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List