Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Write Hund's rule?

Answered: 1 week ago

Question

Identify cultural barriers to communication.

Answered: 1 week ago