Question
Hello I am trying to output my useradd command instead of execute the function so that when I run my script it shows the useradd
Hello I am trying to output my useradd command instead of execute the function so that when I run my script it shows the useradd command but doesn't actually run it.
This is my script file that I am using #!/bin/bash
DATAFILE=$1
while IFS="," read USERNAME FIRSTNAME LASTNAME EMAIL IPADDRESS HIREDATE DEPARTM>
HIREDATE="$( date +'%A %B %d %Y')" EXPIRYDATE="$( date -d "$HIREDATE +3 years" +'%A %B %d %Y' )" USERADD="$(useradd -c "$EMAIL" -e "$HIREDATE" -m -s /bin/bash "$USERNAM>
echo " Useradd: $USERADD" echo " Username: $USERNAME" echo " Full Name: $FIRSTNAME $LASTNAME" echo " Department: $DEPARTMENT" echo " EMAIL: $EMAIL" echo " Hire Date: $HIREDATE" echo " Expiry Date: $EXPIRYDATE" echo " IP Address: $IPADDRESS" echo "---" done < $DATAFILE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started