Skip to main content
Typos
Source Link
user232326
user232326

Script that e-mails predifinedpredefined message to multiple users

I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it should send an email to the user from a predifinedpredefined .txt file. If the user does not exist it should persist until a valid username is given. Also if the word "exit" is submitedsubmitted as username the script should exit. This is what i have done so far:

#!/bin/bash
echo "Input your username"
dir="/home"
read username

if [$username -e $dir]
then 
cat Message.txt | mailx -s "Subject" $username
else
echo "The user does not exist. Please type a valid username."
fi

I think the part with the message is fine(not sure though) but i have problems with the exit and the input validation!

Script that e-mails predifined message to multiple users

I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it should send an email to the user from a predifined .txt file. If the user does not exist it should persist until a valid username is given. Also if the word "exit" is submited as username the script should exit. This is what i have done so far:

#!/bin/bash
echo "Input your username"
dir="/home"
read username

if [$username -e $dir]
then 
cat Message.txt | mailx -s "Subject" $username
else
echo "The user does not exist. Please type a valid username."
fi

I think the part with the message is fine(not sure though) but i have problems with the exit and the input validation!

Script that e-mails predefined message to multiple users

I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it should send an email to the user from a predefined .txt file. If the user does not exist it should persist until a valid username is given. Also if the word "exit" is submitted as username the script should exit. This is what i have done so far:

#!/bin/bash
echo "Input your username"
dir="/home"
read username

if [$username -e $dir]
then 
cat Message.txt | mailx -s "Subject" $username
else
echo "The user does not exist. Please type a valid username."
fi

I think the part with the message is fine(not sure though) but i have problems with the exit and the input validation!

Removed unnecessary text. Added tag.
Source Link
Paulo Tomé
  • 3.9k
  • 6
  • 28
  • 40

I am new to unix coding so i need your help! I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it should send an email to the user from a predifined .txt file. If the user does not exist it should persist until a valid username is given. Also if the word "exit" is submited as username the script should exit. This is what i have done so far:

#!/bin/bash
echo "Input your username"
dir="/home"
read username

if [$username -e $dir]
then 
cat Message.txt | mailx -s "Subject" $username
else
echo "The user does not exist. Please type a valid username."
fi

I think the part with the message is fine(not sure though) but i have problems with the exit and the input validation! Thanks for your time and help!

I am new to unix coding so i need your help! I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it should send an email to the user from a predifined .txt file. If the user does not exist it should persist until a valid username is given. Also if the word "exit" is submited as username the script should exit. This is what i have done so far:

#!/bin/bash
echo "Input your username"
dir="/home"
read username

if [$username -e $dir]
then 
cat Message.txt | mailx -s "Subject" $username
else
echo "The user does not exist. Please type a valid username."
fi

I think the part with the message is fine(not sure though) but i have problems with the exit and the input validation! Thanks for your time and help!

I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it should send an email to the user from a predifined .txt file. If the user does not exist it should persist until a valid username is given. Also if the word "exit" is submited as username the script should exit. This is what i have done so far:

#!/bin/bash
echo "Input your username"
dir="/home"
read username

if [$username -e $dir]
then 
cat Message.txt | mailx -s "Subject" $username
else
echo "The user does not exist. Please type a valid username."
fi

I think the part with the message is fine(not sure though) but i have problems with the exit and the input validation!

Source Link

Script that e-mails predifined message to multiple users

I am new to unix coding so i need your help! I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it should send an email to the user from a predifined .txt file. If the user does not exist it should persist until a valid username is given. Also if the word "exit" is submited as username the script should exit. This is what i have done so far:

#!/bin/bash
echo "Input your username"
dir="/home"
read username

if [$username -e $dir]
then 
cat Message.txt | mailx -s "Subject" $username
else
echo "The user does not exist. Please type a valid username."
fi

I think the part with the message is fine(not sure though) but i have problems with the exit and the input validation! Thanks for your time and help!