Help with bash script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am writing a bash script to run the nisclient command on a word list with
a for in loop. I'm using a  here document to accept user
input in this case I want it to be the letter y so that the script continues. When I run the script you'll see below it just asks
over and over if you want to continue y or n. I want the script
to enter y and continue.
If someone knows a better way and can provide the code that would be helpful as well.

Here is the script I have so far

bash-2.03# more change_nis_cred.sh
#This script script cycles through a word list and uses a for in loop.
set -x
#
for user in credlist.txt
do
# Start of Here document
#
nisclient -cl newpass $user <<- FINIS
echo "Changed $user account password"
        FINIS
done
bash-2.03#

This is what happens when I run the script

# ./change_nis_cred.sh
++ nisclient -cl newpass credlist.txt

You will be adding DES credentials in domain daveo.gov. for
credlist.txt

** nisclient will not overwrite any existing entries in the
** credential table.

Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n' to exit this script) Do you want to continue? (type 'y' to continue, 'n

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux