Sure. Ill try that out. Sorry for the delayed response. I'm stuck in
setting up Arch in a VM. I'm in iteration 4 now. I have managed to install
it, but I;m having issue with pacman. Will tryt today and share my the
errors in a new thread.

Thanks,
Suhail

On Tue, May 5, 2020 at 10:27 PM Nikhilesh Susarla <[email protected]>
wrote:

> On Tue, May 5, 2020, 20:40 Muhammed Suhail <[email protected]>
> wrote:
>
>> Hello again, Ragini,
>>
>> So I used [[ $UID != 0 ]] to check for root.
>>
>> @Nikhilesh I modified the script and find below the latest iteration:
>> #!/bin/bash
>> #!/bin/sh
>>
>
> Why do you have mentioning two shells ?
>
>
> if [[ $UID != 0 ]]
>> then
>>  exit 1
>> fi
>>
>> if [[ $?=0 ]]
>> then
>>  read -p 'Enter the new username' $USER_NAME
>>  read -p 'Enter Real name' $COMMENT
>>  read -p 'Enter password' $PASSWORD
>> else
>>  exit 1
>> fi
>> #create account
>> if [[ "${?}" == 0 ]]
>> then
>>  useradd -c "${COMMENT}"-m $USER_NAME
>>  echo $PASSWORD | passwd --stdin ${USER_NAME}
>>
>
> For a fast check, you can run these individual commands on terminal.
>
> Set $username, $password, $comment in the shell.
> Then execute the useradd command and the password command. If they work.
> Then the script should not have a problem. You can verify it that way too.
>
>  echo Working...
>> else
>>  echo not working
>>  exit 1
>> fi
>>
>> if [[ $? == 0 ]]
>> then
>>  echo "Account Created" "Username: ${user_name}, Host: ${HOSTNAME}"
>>
>>
>> Issues:
>> -So I had a previous iteration which gives an error "Unexpected end of
>> file"
>> - The script fails at the useradd command.
>>
>> Can you please describe what is the exact syntax error you getting?
>
>
> Thank you.
> Susarla Nikhilesh
>
>
>>>

Reply via email to