Need to create a bash script to create a username from a file which contains below (username home directory full name)
drs /home/drs Paranas Theruwalan
My script:
!#/bin/bash
#call data from file
file="file.txt"
USERNAME=$(cat file.txt | cut -d: -f1)
USER_FULLNAME=$(cat file.txt | cut -d: -f2)
useradd -m ($USERNAME) -c ($USER_FULNAME)
I getting invalid username error.
Asked by Suresh Silva
(1 rep)
Aug 15, 2018, 09:23 AM
Last activity: Sep 18, 2022, 05:03 PM
Last activity: Sep 18, 2022, 05:03 PM