For loop exiting

Hi ,
I am processing some files using below shell script the problem for loop exit after processing some files even though it exist.After modifying file.txt and rerunning the script and its running .Any Advise

for i in `cat /xx/file.txt |tr -s "," '\n' ` ; do
echo $i
input=/xx/20160108/$i/*.snappy
output=/yy/zz/20160108/$i
sudo -u hdfs  hadoop jar /xx/hadoop-streaming.jar  -D mapreduce.task.io.sort.factor=20 -D mapred.output.compress=true \
-input $input  -output $output
rc=$?
if [ ${rc} -ne 0 ];then
echo "File not exist"
exit 1
fi
done

cat file.txt

10,11,12,13,14,15,16,17,18,19,20,21,22,23


6/02/16 01:56:40 INFO streaming.StreamJob: Output directory: /xx/20160108/14
15
sudo: sorry, you must have a tty to run sudo
File not exist

In /etc/sudoers (or via visudo ) change

Defaults: requiretty

to

Defaults: !requiretty
1 Like

The sudoers file does allow you a bit more granularity that to disable the feature for everyone. Instead you can just do it per user need and even for just the command necessary.
e.i.

Defaults:username !requiretty

Thannks :b: